Discord
BoostGPT Discord is a streamlined and user-friendly SDK that enables you to set up your own AI Discord bot in a flash.
Last updated
Was this helpful?
BoostGPT Discord is a streamlined and user-friendly SDK that enables you to set up your own AI Discord bot in a flash.
Last updated
Was this helpful?
Can reply to direct messages
Can reply when mentioned in a channel.
Can engage in a conversation.
Node v10 and above
DISCORD_TOKEN:
You will need a Discord account and a bot application to get a token for your bot. Create a bot account by following the instructions on the , and get a bot token.
DISCORD_BOT_ID:
You will need to have created a Discord bot and have its ID. To get your bot's ID, go to your bot's application page on the and copy the client ID.
OPENAI_API_KEY:
You need to have an OpenAI account and API key. Go to the , create an account, and generate an API key.
BOOSTGPT_API_KEY:
You need to have a BoostGPT account and API key. Go to the , create an account, and generate an API key.
BOOSTGPT_PROJECT_ID:
You need to create a project on BoostGPT to use its API. After creating a project, you can get its project ID from the dashboard.
BOOSTGPT_BOT_ID:
You will need to have created a BoostGPT bot and have its ID. To get your bot's ID, go to your bot's settings page on the BoostGPT dashboard and copy the bot ID.
git clone git@github.com:boostgpt/boostgpt-discord.git
Run npm install
To create a .env file with the above requirements, you can follow these steps:
Rename the file .env.exclude to .env.
Open the .env file in a text editor.
Edit the following lines in the file, replacing the placeholders with the actual tokens and IDs:
Save the file
Make sure to keep the .env file secure and not share it publicly, as it contains sensitive information that could be used to access your bots and APIs.
Run node index.js
to start your bot.
We recommend using the pm2 process manager to start your bot in production mode.
To do this you have to:
Install pm2 globally using the command npm install -g pm2
.
Navigate to the directory where your index.js file is located.
Start your bot by running the command pm2 start index.js --name my-bot
where my-bot is the name of your bot.
Pm2 will automatically detect the Node.js runtime and launch the application in cluster mode.
Verify that your bot is running by checking its status with the command pm2 status
.
If you need to stop the bot, you can run the command pm2 stop my-bot
.
If you need to restart the bot, you can run the command pm2 restart my-bot
.
Using pm2 provides a number of benefits, including process management, automatic restarts in case of crashes, and monitoring capabilities.