The purpose of this project is to create an engine for easy creation and management of Discord bots, with straightforward implementation of slash commands.
Project Benefits
This project streamlines the process of developing and managing Discord bots, making it accessible for developers to integrate slash commands and manage bot functionalities.
How the Project Works
The project sets up a Discord bot engine using Node.js, allowing developers to quickly create bots and implement slash commands with minimal setup.
Repository and Installation
To install and run the project:
-
Clone the repository:
Terminal window git clone https://github.com/Fulldroper/discord.bot.enginecd discord.bot.engine -
Install dependencies and start the bot:
Terminal window npm installnpm start
Project Workflow
-
Setup Project: Initialize the project structure and dependencies.
Terminal window npm initnpm install -
Create Discord Bot: Set up the bot and configure it to use slash commands.
// env configurationprocess.env.NODE_ENV || await require('dotenv').config({ debug: false })// req discord frameworkconst { Client, GatewayIntentBits } = await require('discord.js');// init discord bot && rest objconst bot = new Client({ intents: [GatewayIntentBits.Guilds,GatewayIntentBits.GuildMessages,GatewayIntentBits.MessageContent,GatewayIntentBits.GuildMembers,GatewayIntentBits.GuildIntegrations] });// add command builderbot.cim = require("fd-dcc")// mount sitebot.site = require("fd-dsite")// run botbot.login(process.env.TOKEN) -
Implement Slash Commands: Add functionality for handling slash commands.
// mount comandsbot.cim(__dirname +"/commands/")// catch errorsbot.on("error", console.log)bot.on("ready", async function () {// await this.db.connect()let users_counter = 0await this.guilds.cache.forEach(async s => users_counter += s.memberCount )this.users_counter = users_counterconsole.log('[start] as ', this.user.tag, " at ", new Date);console.log(`[Commands](${Object.keys(this.cmds).length}):`, Object.keys(this.cmds));console.log(`[Servers](${this.guilds.cache.size})`);console.log(`[Users](${users_counter})`);this.site({name: this.user.username,logo: this.user.avatarURL(),description: this.description,uid: this.user.id,donate: '',site: '',telegram: '',email: '',commands: this.cmds})})
Skills Gained
- Developing Discord bots with Node.js
- Implementing and managing slash commands
- Creating scalable bot engines for easy management