Written with TypeScript and Discord.js library, this template will help you to create and deploy your Discord 🤖
- Copy the files using
git clone https://github.com/T-Damer/discord-bot-template.git
- Run
yarn
to install dependencies - Go to discord for developers and create a new app
- Select your app from above and go to
OAuth2 -> URL Generator
, selectbot
,applications.commands
- 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
) - Create
.env
file in project root, use.env.example
to fill it properly - Run
yarn dev
and try sending/help
or/ping
into yourtext-channel
yarn dev
— runs the app in the development modeyarn start
— builds the app for production to thebuild
folder and runs your appyarn deploy:commands
— rebuilds commands fromcommands
folder intobuild
folder
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
- Create a (new) Heroku account
- Connect Heroku account with your GitHub repo with your bot and
Deploy
the bot to Heroku - On Heroku dashboard go to
Resources
, disableweb
and enableworker