barrientosvctor / Djs-Bot-Typescript

A discord bot example with discord.js v14 package and written in TypeScript. This example includes context menus and prefix/slash commands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DJS v14 Bot using TypeScript

Prerequisites

Packages list

Setup

  1. Use npm i command to install all packages.

  2. Go to config.json file and fill the strings with their bot data.

{
    "token": "their bot token here",
    "prefix": "!",
    "slash": {
        "testing": false,
        "serverTest": "their personal server ID here",
        "botID": "their bot ID here"
    }
}
  1. Run the project with npm run start command.

Notes

  • The property slash.testing in config.json file is used to specify if you want to deploy your slash commands only on one server or all servers:

true: It deploys only on the server that you specified in slash.serverTest property.

false: It deploys on all servers.

  • I'm using a json file for this example to save the bot data, but if you want could can use Environment Variables, just replace variables in the code.

  • I set the intents number to 3276799 in Client.ts file for have no problem, but you can modify this number with the intents that you need. For this, use the Discord Intents Calculator website.

About

A discord bot example with discord.js v14 package and written in TypeScript. This example includes context menus and prefix/slash commands.


Languages

Language:TypeScript 100.0%