Giter Club home page Giter Club logo

typescript-discord.js-bot-template's Introduction

TypeScript Discord.js Bot Template

You are expected to know the basic fundamentals of JavaScript, TypeScript, Node.js. It would also be useful if you know basic usage of your device's operating system.

Required Versions

  1. You are required to have 'Node.js' v16.9 (~v7.21.1 npm) or above!
  2. Discord.js v14.2.0.

Getting Started

  1. Setting up dotenv files.
    • Remove .example from the production.env.example, development.env.example, and .env.example files.
  2. Obtain a bot token and bot Id.
    • You'll need to create a new bot in your Discord Developer Portal application dashboard.
      • At the end you should have a Bot Token.
  3. Modify the dotenv files.
    • Open the production.env file.
    • Insert your bot token as the value of DISCORD_TOKEN.
    • Insert your bot Id as the value of CLIENT_ID.
    • Do the same steps for development.env.
    • Inside the .env file, either use "development" or "production" for the NODE_ENV key. The key production will use the production.env file, and development will use the development.env file.
  4. Install the needed dependencies.
    • Navigate into the installed source files and type npm install.
  5. Register commands.
    • In order to use application commands, they first have to be registered.
    • Type npm run deploy-commands to register the bot's application commands globally.
      • Run this script any time you change a command name, structure, or add/remove commands, etc.
      • This is so Discord knows what your commands look like.
      • Command deployments should be almost instant whether it is being deployed in a guild or globally.

Start Scripts

Disclaimer We also have .replit and start.bat files you can use, along with a Procfile for Heroku but you must change the scripts yourselves if you do not want the one that is currently set.

Docker

Docker will be in the works, no ETA is set for this.

You can run the bot in multiple modes:

  1. Normal Mode
    • Type npm run start:bot.
    • This starts a single instance of the bot.
  2. Sharding Mode
    • Type npm start.
    • Starts the bot with sharding.
  3. PM2 Mode
    • Note: You may have to run this as an Administrator in order to use this or you may get a Permission Denied error. This may apply to other scripts inside package.json and should be handled accordingly.
    • Inside process.json you will see this object: env: { "NODE_ENV": "development" }, you are free to change it as it acts as the .env's NODE_ENV key. Change it either to production or keep it as development.
    • Type npm run start:pm2.
    • This is similar to Sharding Mode but it also uses PM2 to manage processes.

typescript-discord.js-bot-template's People

Contributors

hauntmore avatar

Stargazers

reversegem_7 avatar  avatar Stroos avatar Hyphen avatar  avatar

Watchers

 avatar

Forkers

dhanxd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.