A multipurpose discord bot based on discord.js v14.
Warning If you plan to host a public instance of Nub Bot by using our source code, you are not allowed to use either Nub Bot's username or its app icon.
Note If you plan to use our source code for your project, it would be appreciated if you credit us. We do not provide coding support. You are expected to solve your personal issue(s) with necessary knowledge. However, if you discover any issue(s) within the public instance of Nub Bot, feel free to report it here.
- Download Node.js.
- Download Visual Studio Code.
-
Project Setup
-
Fork the Github project :
-
Click the
Codebutton. From the drop-down that appears, clickDownload ZIPto download the entire repository as a ZIP folder. -
Extract the files to a new folder and open it with Visual Studio Code.
-
-
Obtain Discord Bot Token
-
Sign in to Discord Developer Portal.
-
Create a bot :
- Enter the left side
Applications. - Click
New Applicationin the upper right corner and enter the name of the bot. After confirmation, enter the new page. - Click on the left side
Bot. - Enable all intents listed under
Privileged Gateway Intentsand clickSave Changes. - View and copy the token by clicking the
Reset Tokenbutton.
- Enter the left side
-
Set up OAuth2 :
- Click on
OAuth2in the left column. - Click on
URL Generatorin the left column. - In the right column, select
botandapplications.commandsunderSCOPES. - Scroll down and select
AdministratorunderBOT PERMISSIONS. - Copy the URL at the bottom and paste it into your browser.
- Choose the server you want to add the bot to and click
Continue>Authorize.
- Click on
-
-
Obtain MongoDB Connection String
- Sign up / Sign in to MongoDB.
- Choose your preferred cloud database plan.
- Customise the cluster settings to your preference and click
Create Cluster. - Navigate to the
Network Accesspage, clickAdd IP Addressand selectAllow access from anywhere. - Navigate back to the
Databasepage and clickConnect. - Create a
database user, clickChoose a connection methodand selectConnect your application. - Copy your connection string and replace
<password>with the password for the database user that you created earlier.
-
Project Execution
- Navigate to the
Botpage on the Discord Developer Portal and clickReset Token. Afterwards, create a.envfile within the root directory. - Paste your bot token into the
TOKENvariable inside the.envfile. - Paste your MongoDB connection string into the
MONGODBURLvariable inside the.envfile. - Navigate to the
OAuth2page and copy theCLIENT ID. - Paste your client ID into the
clientIdvariable inside thehandleCommands.jsfile. - Navigate to your discord server, enable developer mode and right click the dropdown beside the server name.
- Click
Copy Server IDand paste it into theguildIdvariable inside thehandleCommands.jsfile. - Navigate to the
package.jsonfile and pay attention to the packages listed underdependencies. - Open the terminal in Visual Studio Code and install all necessary packages using
npm i <package-name>. For example :
npm i discord.js
- Open a new terminal and type
node .ornode src/index.jsin there to turn the bot online.
- Navigate to the
We're open to accepting contributions. Please refer to our contributing guide before making one.
Connect with us on Discord for support / any related inquiry.
Released under the terms of GNU General Public License v3.0 license.
