Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 2.23 KB

README.md

File metadata and controls

80 lines (58 loc) · 2.23 KB

ticket-bot

The main ticket/support bot used in the Moniker discord server.

Installation

  1. Create a repository from this template OR clone this repository.
  2. Use your favourite package manager (Yarn is recommended) to install the dependencies, npm install or yarn.
  3. Run npm start or yarn start to start the bot.

Configuration

  1. Create a .env file in the root directory of the project.
  2. Add the following variables to the .env file:
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

Usage

Slash Commands

  1. To create a slash command, create a new file in the commands directory.
  2. 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.
}
  1. The command should be registered every time the bot is started.

Events

  1. To create an event, create a new file in the events directory.
  2. 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.
}

Interactions

  1. To create an interaction, create a new file in the interactions directory.
  2. 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.
}

Helpful Links