Skip to content

Third Party Developer

Xiled Emerald edited this page Jul 1, 2022 · 2 revisions

SupportBot Add-ons

Hello Developers! So I assume you're reading this because you're Developer interested in creating an addon correct? Well you're in the right place. First of all you'll need to understand and have knowledge with Node/Discord.js. This is what SupportBot is based off.

  1. You'll see a directory called /Addons/ in your version of SupportBot. This is where you're addon will config, and its config folder will be /Addons/Configs/.

Creating your Add-on

So let's set-up the base for your Addon. Head into the /Addons/ directory and create the file for your addon with the .js extension.

Now lets start by requiring the default modules

const fs = require("fs");

const Discord = require("discord.js");
const yaml = require("js-yaml");
const supportbot = yaml.load(
  fs.readFileSync("./Configs/supportbot.yml", "utf8")
);

// If you need to read something from the main config!
const cmdconfig = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));

// This is for your Addon Configuration
const config = yaml.load(fs.readFileSync('./Addons/Configs/YourAddonConfig.yml', 'utf8'));

const { Command, Event } = require("../Structures/Addon");

Now lets set-up add-on handler

module.exports.commands = [

  new Command({
    name: "your-cmd-name",
    description: "your-command-description",
    options: [],
    permissions: ["SEND_MESSAGES"],
    async run(interaction) {

      const Embed = new Discord.MessageEmbed()
        .setDescription("Hello World!")
        .setColor(supportbot.InfoColour);

      interaction.reply({
        embeds: [Embed],
      });

    },
  }),

];

Event Example

module.exports.events = [

  new Event("ready", async (client) => {
    console.log("Bot started!");
  }), 
];