Skip to content

Latest commit

 

History

History
127 lines (86 loc) · 5.01 KB

README.md

File metadata and controls

127 lines (86 loc) · 5.01 KB

Discord Bot TypeScript Template

discord.js License

Discord bot - A discord.js bot template written with TypeScript.

Introduction

This template was created to give developers a starting point for new Discord bots, so that much of the initial setup can be avoided and developers can instead focus on meaningful bot features. Developers can simply copy this repo, follow the setup instructions below, and have a working bot with many boilerplate features already included!

For help using this template, feel free to join our support server!

Features

Built-In Bot Features:

  • Basic command structure.
  • Rate limits for commands.
  • Welcome message when joining a server.
  • Shows server count in bot status.
  • Posts server count to popular bot list websites.
  • Support for multiple languages.

Developer Friendly:

  • Written with TypeScript.
  • Uses the discord.js framework.
  • Built-in debugging setup for VSCode.
  • Support for running with the PM2 process manger.
  • Support for running with Docker.

Scales as Your Bot Grows:

  • Supports sharding which is required when your bot is in 2500+ servers.
  • Supports clustering which allows you to run your bot on multiple machines.

Commands

This bot has a few example commands which can be modified as needed.

Help Command

A help command with a bot description, list of commands, and important links.

Help Command

Test Command

A generic command, which can be copied to create additional commands.

Test Command

Info Command

An info command, which shows more information and relevant links.

Info Command

Dev Command

A dev command, which shows detailed information that may be helpful to developers.

Dev Command

Misc Commands

There are additional commands built-in that simply provide relevant links (invite, docs, support, vote).

Misc Commands

Welcome Message

A welcome message is sent to the server and owner when the bot is added.

Welcome Message

Setup

  1. Copy example config files.
    • Navigate to the config folder of this project.
    • Copy all files ending in .example.json and remove the .example from the copied file names.
      • Ex: config.example.json should be copied and renamed as config.json.
  2. Obtain a bot token.
    • You'll need to create a new bot in your Discord Developer Portal.
      • See here for detailed instructions.
      • At the end you should have a bot token.
  3. Modify the config file.
    • Open the config/config.json file.
    • You'll need to edit the following values:
      • client.token - Your discord bot token.
  4. Install packages.
    • Navigate into the downloaded source files and type npm install.

Start Scripts

You can run the bot in 4 different modes:

  1. Dev Mode
    • Type npm start:dev.
    • This runs the bot with ts-node-dev.
    • Use this mode for general development.
    • TypeScript files are compiled automatically as they are changed.
  2. Normal Mode
    • Type npm start.
    • This runs the bot directly with Node and without shards.
    • Use this mode if you don't need sharding.
  3. Shard Mode
    • Type npm run start:shard.
    • This runs the bot directly with Node and with sharding enabled.
    • Use this mode if you need sharding.
  4. PM2 Mode
    • Run by typing npm run start:pm2.
    • This runs the bot using the process manager PM2.
    • Use this mode if you require the bot to always be online.

Bots Using This Template

A list of Discord bots using this template.

Bot Servers
Birthday Bot
Friend Time
QOTD Bot

Don't see your bot listed? Contact us to have your bot added!