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 i
Get 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 > Bot
under a new application and get theTOKEN
from the page. -
Add Client ID Go to
Settings
under a new application and get theCLIENT_ID
from 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
#welcome
channel and#suggestions
channel 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_KEY
andB_ID
from Brainshop -
News API
NEWS_API_KEY
from 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 dev
Start the bot -
$ npm start