The main ticket/support bot used in the Moniker discord server.
- Create a repository from this template
ORclone this repository. - Use your favourite package manager (Yarn is recommended) to install the dependencies,
npm installoryarn. - Run
npm startoryarn startto start the bot.
- Create a
.envfile in the root directory of the project. - Add the following variables to the
.envfile:
TOKEN=your-bot-token
CLIENT_ID=your-bot-client-id
GUILD_ID=your-guild-id # Optional but is required for easy testing of slash commands.
MONGO_URI=mongo-connect-uri
MONGO_DB_NAME=db-name
TEAM_ROLE_ID=role-id
TICKETS_CATEGORY_ID=tickets-category-id
- To create a slash command, create a new file in the
commandsdirectory. - Use this code to get started:
import { SlashCommandBuilder } from "discord.js";
// This is required export for the main file to import the command.
export const data = new SlashCommandBuilder()
.setName("name")
.setDescription("description");
export async function execute(interaction) {
// Slash command response goes here.
}- The command should be registered every time the bot is started.
- To create an event, create a new file in the
eventsdirectory. - Here is an example:
import { Events } from "discord.js";
export const event = Events.YourEventName; // The event name. Refer to the discord.js documentation for more info.
export const once = true; // Whether the event should only be executed once, when recieved.
export async function execute(client) {
// Event code goes here.
}- To create an interaction, create a new file in the
interactionsdirectory. - Here is an example:
export const interactionId = "ID"; // The interaction id you gave when registering the interaction.
export async function execute(interaction) {
// Interaction response code goes here.
}