Skip to content

T-Damer/discord-bot-template

Repository files navigation

Written with TypeScript and Discord.js library, this template will help you to create and deploy your Discord 🤖


How to run the bot:

  1. Copy the files using git clone https://github.com/T-Damer/discord-bot-template.git
  2. Run yarn to install dependencies
  3. Go to discord for developers and create a new app
  4. Select your app from above and go to OAuth2 -> URL Generator, select bot, applications.commands
  5. Copy link from the bottom and paste it into your browser. Then add the bot to your server with all permissions (I recommend creating separate text-channel)
  6. Create .env file in project root, use .env.example to fill it properly
  7. Run yarn dev and try sending /help or /ping into your text-channel

Available Scripts

  • yarn dev — runs the app in the development mode
  • yarn start — builds the app for production to the build folder and runs your app
  • yarn deploy:commands — rebuilds commands from commands folder into build folder

Environment variables

Name Description
DISCORD_BOT_TOKEN In discord for developers go to bot tab and click Reset token button
CLIENT_ID Get it in General Information tab inside discord for developers
GUILD_ID Enter in development mode inside Discord (check settings->Advanced). Use RMB to copy the data

Consider looking into .env.example


Deploying to Heroku

  1. Create a (new) Heroku account
  2. Connect Heroku account with your GitHub repo with your bot and Deploy the bot to Heroku
  3. On Heroku dashboard go to Resources, disable web and enable worker