Discord bot for KaoGeek, built with TypeScript and discord.js
Make sure to use same node version as specified in .nvmrc
by using nvm
nvm use
If not installed, use nvm install
to install specified version in .nvmrc
(at the time of writing lts/hydrogen
)
Enable Corepack (if not yet),
this will automatically install pnpm
with the version specified in
package.json#packageManager
.
corepack enable
This will ensure all developers use the same version of pnpm
.
Corepack will automatically switch pnpm's version when you switch to
different workspace.
Install dependencies
pnpm install
GUILD_ID
in your .env
)MOD_CHANNEL_ID
in your .env
)Bot
tab get the bot's token by clicking Reset Token
button, copy the token and keep it save, don't share this to anyone! (This will be BOT_TOKEN
in your .env
)Privileged Gateway Intents
section, enable PRESENCE INTENT
, SERVER MEMBERS INTENT
, and MESSAGE CONTENT INTENT
OAuth2
-> URL Generator
tab, select bot
and applications.commands
scopes, then select permissions under Bot Permissions
section, copy the generated URL and paste it in your browser, then choose your server to add the bot.You can set to Administrator
for ease of development, but it's not recommended for production.
Copy the .env.example
to .env
cp .env.example .env
Then, set all variables in .env
file
To run the bot in development mode
pnpm dev
Or run the bot in watch mode with automatic rerun on changes
pnpm dev:watch
The production instance of the Discord bot is hosted by Yue.sh. To deploy to production, trigger the Deployment workflow on GitHub Actions.
Log from the production bot is sent to Papertrail. If you have access to Papertrail, you can view the logs at https://my.papertrailapp.com/systems/kaogeek/events
docker build -t kaogeek-discord-bot .
docker run -d --env-file=.env --name kaogeek-discord-bot kaogeek-discord-bot
pnpm install
pnpm build
pnpm start