Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

TMUniversal/discord-bot-template

Repository files navigation

Discord Bot Template (TypeScript)

Getting Started

Hosting a discord bot comes with some requirements:

Installation

Assuming you have Node.js installed, install the required packages:

Please use the latest version on Node.js, as this project is constantly keeping up to date. discord-bot-template is built and tested with the latest version of Node.js (as of now that is v14.4.0)

  • In the project folder: yarn install

Setup

  • In the config directory, make a copy of main.example.json, rename it to main.json.

  • Fill in the necessary values, remove the comment (since comments are not supported in JSON).

    • owners may be an array of strings
  • Customize what your bot says and does, here's what you should change:

    • Status messages in src/client/BotClient.ts
    • Your bot's description in src/commands/basic/AboutCommand.ts
    • The required permissions in src/commands/basic/InviteCommand.ts
  {
    "clientToken": "<Discord Bot Token>",
    "webhook": {
      "id": "",
      "secret": ""
    },
    "prefix": ">",
    "owners": "<Your Discord ID>",
    // OR
    "owners": ["<Your Discord ID>", "<Another Discord ID>"]
  }

Starting

To start the bot, it must first be complied.

  • Run yarn run build

  • You may then start with yarn start or, if you have pm2 installed: pm2 start pm2-start.json

  • Alternatively: Run yarn run cs to build and then start.

Credits

Credits to Hydractify for their logging system.

License

discord-bot-template is released under the MIT License.