A simple discord bot dased on Discord.js v14
Working from a fork of the repo will allow to make changes to the repo under your own without disturbing anything in the real repo. Make changes like crazy.
$ npm iGet your own Environment variables for the services and APIs used.
Copy .env.sample to .env and replace the required values
$ cp .env.sample .env-
Add your Discord Bot Token Go to
Settings > Botunder a new application and get theTOKENfrom the page. -
Add Client ID Go to
Settingsunder a new application and get theCLIENT_IDfrom the page. -
Add WebHook Data This guide shows you how to create a webhook for a specific channel, the bot listens for the welcome messages in the
#welcomechannel and#suggestionschannel for instance. https://discordjs.guide/popular-topics/webhooks.html#creating-webhooks-through-server-settingsFor Example - If your webhook url looks like this -
https://discord.com/api/webhooks/1234567891011121314/smTYeBU3JWkp4TTTODtEcJDCS2oTfvseAEKezTYvniassEkeMLBg9aKZX1igmxec7RDsES, the first part is theWEBHOOK_ID, and the second is theWEBHOOK_TOKEN.The current webhooks used are for -
- welcome messages -
WEBHOOK_ID,WEBHOOK_TOKEN. - suggestions -
SUGGESTION_WEBHOOK_ID,SUGGESTION_WEBHOOK_TOKEN
- welcome messages -
-
Mongo Connection URI
MONGODB_URI- The URI for the local Mongo DB to connect to. -
Brainshop AI for the chatBot
AI_KEYandB_IDfrom Brainshop -
News API
NEWS_API_KEYfrom NewsAPI
Generate an invite URL under OAuth2 > URL Generator on the Discord Development portal and invite the bot to your respective server.
Start a auto refresing dev server -
$ npm run devStart the bot -
$ npm start