Sign up for a new application on the Discord developer portal.
On the developer portal dashboard, you will want to select your new application and enable the bot setting on the application's page. You will need the bot token to create the .env
file.
Create a .env
file and fill out the following value(s). If you do not know your bot token, you can refresh it on the application's main page.
Setting ENV to production
value will register commands globally.
ENV=
BOT_TOKEN=
CLIENT_ID=
GUILD_ID=
MONGO_URI=
On the application's main page, you will want to navigation to Settings -> OAuth2 -> URL Generator. Follow the choices below.
- Scope:
bot
- Bot Permissions:
administrator
- Copy the generated URL and paste it into your browser
- You will receive an OAuth2 message for your bot, choose the server you wish to add it to, continue and authorize
You should see your bot join the selected discord server.
You will need a MongoDB URI connection string to a database. This can be done by installing MongoDB Compass or by using MongoDB Atlas
Running the startup command node index.js
will display a message in terminal. If you look at the users list of the server the bot was invite to, the bot will be online.
The bot utilizes slash commands in it's current state. Typing /emi
will generate a response from the bot.