Advanced Discord bot with many fun and entertaining features. Helps you manage the server better and more securely. The project is in the testing and development phase.
MIT License
Advanced Discord bot with many fun and entertaining features. Helps you manage the server better and more securely. The project is in the testing and development phase.
Download Project from GitHub:
Method 1: From the project page on GitHub:
Go to the project's GitHub page.
Click the "Code" button and select "Download ZIP" to download the entire source code as a ZIP file.
Go to the folder containing the downloaded file
Extract the ZIP file to the desired folder on your computer.
Learn how to extract
Method 2: Use Git to clone the repository:
Open a terminal or command prompt.
Navigate to the folder where you want to save the project.
Run the following command to clone the repository:
git clone <URL_repository>
(Replace <URL_repository>
with the URL of the repository on GitHub, for example: https://github.com/username/repository.git
).
Move into the newly cloned project folder:
cd <folder_name>
(Replace <folder_name>
with the project folder name).
Install IDE or Text Editor:
Use Text Editor Visual Studio Code (VS Code):
Download and install from the official website Visual Studio Code.
Install the necessary extensions to support JavaScript development.
See details on how to install VS Code here.
Recommended to use VS Code because it is easy to use :))
Use other Text Editors or IDEs if you find it suitable:
Environment Setup:
Download and install Node.js from the official website Node.js. Choose the LTS (Long Term Support) version to ensure stability.
Check the Node.js installation by opening a terminal or command prompt and typing the commands:
node -v
and
npm -v
Access the project on VS Code:
Method 1:
Method 2:
Drag and drop the project folder from File Explorer (Windows) or Finder (macOS) into the VS Code window.
VS Code will automatically open the project folder and display its contents in the interface.
Method 3:
Open the built-in terminal in VS Code by pressing Ctrl + `` (or
Cmd + `` on macOS).
Use the cd
command to navigate to the folder containing the project.
cd <folder_name>
code .
Method 3:
Open File Explorer (Windows) or Finder (macOS).
Navigate to the folder containing the project.
Right-click on the project folder.
Select "Open with Code" from the menu.
The project folder will be opened in VS Code.
Learn more about using VS Code
Go to Discord Developer Portal.
Log in with your Discord account if you are not already logged in.
Select your bot application from the list of applications.
Go to Bot in the left menu.
Click the Copy button under TOKEN to copy your TOKEN. Note: Do not share this TOKEN with anyone as it may allow others to control your bot.
On the same page of the bot application, go to Bot.
Look for Privileged Gateway Intents.
Presence Intent:
Enable Presence Intent so that the bot can receive user status update events.
Note: Once your bot reaches 100 or more servers, enabling this feature will require verification and approval from Discord. See more details here.
Server Members Intent:
Enable Server Members Intent so your bot can receive member-related events in your server.
Note: Once your bot reaches 100 or more servers, enabling this feature will require verification and approval from Discord. See more details here.
Message Content Intent:
Enable Message Content Intent so your bot can receive message content in most messages.
Note: Once your bot reaches 100 or more servers, enabling this feature will require verification and approval from Discord. See more details here.
Open the bot's source file (e.g. bot.mjs
).
Find the line containing client.login('YOUR_BOT_TOKEN');
.
Replace 'YOUR_BOT_TOKEN'
with the TOKEN you copied from the Discord Developer Portal:
client.login('YOUR_BOT_TOKEN'); // Replace YOUR_BOT_TOKEN with your bot token
Go to the Discord Developer Portal.
Log in with your Discord account if you are not already logged in.
Select your bot application from the list of applications.
In the left menu, select OAuth2.
Select the URL Generator tab under OAuth2.
In the Bot Permissions section, select the permissions your bot needs to function. For example:
Send Messages
: To send messages.
Read Message History
: To read message history.
Manage Messages
: To manage messages (delete, pin, etc.).
View Channels
: To view channels.
Attach Files
: To send attachments.
Add Reactions
: Add reactions to messages in channels that the bot has access to.
Select other permissions if needed.
Recommended to select Administrator
permission
After configuring the scopes and permissions, scroll down to see the generated bot invitation URL.
Copy this URL.
Open a web browser and paste the URL you copied into the address bar.
You will be asked to select the server where you want to invite the bot.
Select the server from the drop-down list that you have administrative rights to (admin rights or equivalent).
Click Authorize to send the bot invitation.
Complete the process by solving the CAPCHA if required.
Make sure the bot has sufficient access to the channels.
Make sure the bot can view messages, add reactions, etc.
Method 1: Using keyboard shortcuts:
Press `Ctrl + `` (backtick key, located just below the Esc key on the keyboard) to open the terminal.
Method 2: Using the menu:
Go to the Terminal menu on the top toolbar.
Select New Terminal from the drop-down list.
``bash node -v npm -v
``
cd
command to navigate to the directory containing your project. For example:``bash cd project_directory_path
``
package.json
file in your project directory. This file contains a list of packages that you need to install.package.json
:npm install
npm install package-name
For example, to install discord.js
, you would run:
npm install discord.js
node_modules
directory and the list of packages will be updated in the package.json
and package-lock.json
files.npm list
This command will list all packages and their versions.
Check Node.js and npm Versions:
To make sure you are using the correct version of Node.js and npm, you can check their versions with the following commands:
node -v
npm -v
Press the key combination `Ctrl + `` (grave accent) to open Terminal in VS Code.
Or you can open Terminal by going to menu Terminal -> New Terminal.
cd
command in Terminal to navigate to the project folder:cd_path_to_project_folder
node
command to run the bot's main file. The main file is bot.mjs
For example:node bot.mjs
or
node .
Ready!
Bot Started
Logged in as BotName#1234!
Make sure you have added your bot to the Discord server by creating an invite URL and granting permissions to the bot.
When the bot successfully runs, it will start working on the server you invited it to.
Ctrl + C
key combination in the Terminal.Checking for Errors:
If the bot is not working as expected or encounters errors, error messages will appear in the Terminal. You can check the errors to know what to fix.
Edit Error Code:
If you encounter an error, edit the code in your bot file, then run the command node bot.mjs
to restart the bot.
nodemon
. To install nodemon
, run the command:npm install -g nodemon
nodemon bot.mjs
node .
on Terminal in VS Code, you will see the bot online.!
Go to import.txt
Copy package game
run
npm install <package_name>
replace <package_name>
with package exist in import.txt
!
bot.mjs
client.on('messageCreate', async message => {
if (!message.content.startsWith('!') || message.author.bot) return; // thay thế ! thành perfix riêng của bạn
const args = message.content.slice(1).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
const command = client.commands.get(commandName);
Replace !
with your own prefix.Step 1: Create a Google Cloud Project
Step 2: Enable Google Sheets API
Step 3: Create a Service Account
Step 4: Create and Download Service Account Key
Step 5: Get Service Account Email Address
Step 6: Grant Service Account Access to Google Sheet
Step 7: Using the Service Account with Google Sheets API
credentials.json
file is downloaded, immediately remove any existing credentials.json
files from the config
directory of your project.credentials.json
.credentials.json
file in the config
directory within your project.config/google-sheet.js
your-google-sheet-id
with your actual Google Sheet ID.sheetname!A:B
with the correct sheet name and range for your use case.
const spreadsheetId = 'your-google-sheet-id'; //replace your-google-sheet-id
const range = 'sheetname!A:B'; //replace sheet name with your sheet
Sheet name
and your workshet name
have a name is DISCORD_DATA
.You must replace sheetname
value is DISCORD_DATA
.data/DevID.json
.{
"devID": "YOUR_USER_ID"
}
Replace YOUR_USER_ID
with your Discord User ID.
Operating system | Yes | No |
---|---|---|
IOS | x | |
Android | x | |
Linux | x | |
MacOs | x | |
Window | x |
Version | Date | Updated content |
---|---|---|
1.0.0 | Create the project and upload code | |
1.0.0.1 | 02/09/2024 7:48 PM (GMT+7) | Update Readme |
1.0.0.2 | 02/09/2024 8:23 PM (GMT+7) | Update all clause |
1.0.0.3 | 02/09/2024 8:30 PM (GMT+7) | Update Readme |
1.0.1 | 15/09/2024 7:46 PM (GMT+7) | Add Moderator commands |
1.0.2 | 15/09/2024 7:48 PM (GMT+7) | Add In-game infomation command |
1.0.2.1 | 24/09/2024 8:34 PM (GMT+7) | Update bot.mjs |