GitHub Repository Statistics/Info:
Discord Server:
Fork/Download For:
Tutorial:
A Discord bot project made with the npm package discord.js version 14 and it handles Prefix and Slash commands, and it includes two Databases: MongoDB and Quick.DB! You can create many commands as you want to improve your Bot. Project made with ❤ by T.F.A#7524.
You can click on the star (⭐️) button above this repository if you liked this project! Thank you all. 🙏
Discord.js Documentation is linked here.
• Node.js v16.9.0 or above.
• Discord.js v14.3.0 or above.
• 1- Go to Discord Developer Portal and then go to Applications
.
• 2- Create a new application and choose it's name.
• 3- Put your application's avatar (not important).
• 4- Go to Bot
section and turn your application into a bot.
• 5- Scroll down and enable the three disabled Privileged Gateaway Intents
intents (PRESENCE INTENT
, SERVER MEMBERS INTENT
, and MESSAGE CONTENT INTENT
).
• 6- Go to OAuth2
section, and then URL Generator
. Select the scopes bot
and application.commands
, and then scroll down to Bot Permissions, select Administrator
(For all guild permissions). Copy the link that is generated below, open a new browser tab, paste the URL, choose a server where your bot will be in, verify yourself that you are not a robot, and Done!
• 1- Download Visual Studio Code.
• 2- Download Node.JS (Check the requirements).
• 3- Open Visual Studio Code, go to Extensions section and install a JavaScript runner. I choosed JavaScript (ES6) code snippets.
• 4- Download the project by clicking on the badge above this guide Download For: Visual Studio Code
. If you are using Chrome right now, you should see below that the download has started.
• 5- After finishing the download, drop the .zip folder into your Desktop, right click on the .zip folder and click on Extract here
.
• 6- After extracting the files into a new folder, delete the .zip folder and rename the created folder into any name you want (not important to rename the folder).
• 7- Open Visual Studio Code, click on Open folder
and choose the created folder to start a new project.
• 8- Go to the folder config
, and then the file config.js
. Fill or change the values of the variables as you want. Here's the config.js code below and a small guide:
module.exports = {
Prefix: "?", // YOUR BOT PREFIX.
Users: {
OWNERS: ["849413565487382578", "554029264492691476"] // THE BOT OWNERS ID.
},
Handlers: {
MONGO: "" // YOUR MONGO URI. (USE THIS ONLY IN VSCODE)
},
Client: {
TOKEN: "", // YOUR BOT TOKEN. (USE THIS ONLY IN VSCODE)
ID: "" // YOUR BOT ID.
}
}
• 9- Go to terminal and type npm init -y
to install package-lock.json
file, and then type in the terminal again npm install
or npm i
to install all the required dependencies to run your project.
• 10- To start Debugging, Go to the file index.js, press F5, and then choose the debugger Node.js
. Else, go to terminal, and then type node index.js
, node .
, or npm run start
.
• 11- Enjoy! =)
• 1- Go to Replit site and register a new account (If you are new on the site).
• 2- Fork the project by clicking on the badge above this guide Fork For: Replit
.
• 3- Click on Import from GitHub
and wait for Replit to import the repository to your project.
• 4- Type node index.js
, node .
, or npm run start
in the Run button configuration, and then press Done
.
• 5- Go to the folder config
, and then the file config.js
. Fill or change the values of the variables as you want.
⚠️ WARNING: Make sure to not use the variablesTOKEN
orMONGO
in the file config.json! Attackers can steal these secrets and they can steal and use your Database, also use your bot(s) without asking your permissions!. Follow the step #6 to keep these secrets in a safe place.
• 6- Go to Environment Secret Variables
(Located at your left screen with a 🔒 icon). This feature from Replit avoid attackers from accessing your secrets. Use the key as a variable, and the value is the variable's value. The key for your bot token is TOKEN
, and the key for your Mongo URI is MONGO
. After finishing this, click on Add new secret
.
• 7- Click on the green button on top of your screen ► Run
to start running your project.
• 8- Enjoy! =)
This table is also located at official Discord Developer portal: Click here Creating options should be an Array, here's an example:
options: [
{
name: "text",
description: "write anything you want!",
type: 3,
required: false
}
]
⚠️ WARNING: The name of any option should be in lower case.
⚠️ WARNING: All the required options (required = true
) should be the first options, and then the not required options.
We used the type 3
for the String option. There are other option types:
Name: | Value: |
---|---|
STRING | 3 |
INTEGER | 4 |
BOOLEAN | 5 |
USER | 6 |
CHANNEL | 7 |
ROLE | 8 |
MENTIONABLE | 9 |
NUMBER | 10 |
ATTACHMENT | 11 |
const a = interaction.options.get('YOUR OPTION NAME').value;
options: [
{
name: "choice",
description: "Choose something!",
type: 3,
required: true,
choices: [
{
name: "Choice #1",
value: "1"
},
{
name: "Choice #2",
value: "2"
}
]
}
]
⚠️ WARNING: Choices should be in the option type string (3).
Sub commands type is always 1
. You can add more options in a option if you are using the sub command type.
options: [
{
name: "sub",
description: "A sub command",
type: 1,
options: [
{
name: "text",
description: "Write anything you want!",
type: 3,
required: true
}
]
},
{
name: "sub-2",
description: "Sub command 2",
type: 1,
options: [
{
name: "text",
description: "Write anything you want!",
type: 3,
required: true
}
]
}
]
const sub = interaction.options.getSubcommand();
if (sub === "sub") {
// Your code for the sub command #1.
} else if (sub === "sub-2") {
// Your code for the sub command #2.
} else return;
MongoDB is a database program. You can save some documents, data, and more! The official site of MongoDB is linked here.
Quick.db is also a database program, more simplified than MongoDB but doesn't have a lot features. Quick.db uses SQlite files to save data, but MongoDB uses clusters (or Mongo URI) to save data. You can get more information about these both databases in Google.
There are a lot of issues happens with some users. You can create an issue on this repository and I will respond to your opened issue(s) as fast as possible. I'm always busy, so please wait for me to respond to your issues.
Forking this repository and sharing it again without giving credits to me (T.F.A) is not acceptable. You can remove the credits in some bot commands like ?help, ?ping... etc, but not in the main files like README.md, index.js... If you want to make a video about this repository, ask firstly to me and then I will give you the permissions to record, else, bypassing by without asking permissions will ends in a copyright warning.