A Discord bot template based on discordjs@latest.
- 🏁 A Stater Discord bot template based on JavaScript.
- 🏠 Currently by default its Global Slash (
/
) command.
-
Clone the repository and run the following to install the dependencies ( use any package manager you like ):
npm install
-
Create
.env
file in the root directory and add the discord token created at Discord Dev Portal in this format:TOKEN=Your bot Token here MONGODBURL= mongo db url
NOTE
if u dont want any command to be use in dm then set it to false by (
slashcmdbuilder.setDMPermission(false)
).If no any private or mongodburl then leave it empty in .env file
Mongo db URL is optional. If you don't need it, then remove code as well as the
import
fromsrc/events/client/ready.js
file. Then uninstall the mongoose package.
- If you want the code to be kept for a future mongo db connection then let it be there for later use and instead, remove the imports in that file and uninstall packages.
- Start your bot:
node .
If any default errors found while registering commands, it will show here:
- See
how to add commands.md
to add commands - See
how to add events.md
to add events
- Discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
- Usability, consistency, and performance are key focuses of discord.js, and it also has nearly 100% coverage of the Discord API. It receives new Discord features shortly after they arrive in the API.
- Discord.js definition credit : https://discord.js.org/#/