Solix
  • Solix
  • Changelog
    • v0.0.4
    • v0.0.3
    • v0.0.2
  • Quick Start guide
    • Getting started
      • Installing Solix
      • Configuring Solix
      • Configuring Modules
  • Modules
    • Converting
      • Configuring Solix Converting
    • Utility
      • Configuring Solix Utility
    • Logging
      • Configuring Solix Logging
    • Fun
      • Configuring Solix Fun
    • Payments
      • Configuring Solix Payments
    • Ticketing
      • Configuring Solix Ticketing
    • Moderation
      • Configuring Solix Moderation
  • Developer Guide
    • Getting started as a developer
    • How to create a module
Powered by GitBook
On this page
  1. Developer Guide

How to create a module

Creating a module is simple, we have purposefully designed it this way to make modules stress free. You can make modules as complex, or as simple as you like, there is no requirement to use any of our specialist command handlers or event handlers. These are included to make your life easier.

Create a module.

First, create a folder in the modules folder, this can be named whatever you like, it does not matter. Next, within this folder, create a module.js folder. This is the "brain" of the module, and is what the bot will end up reading. Next, you need to create the code for the module file, it is relatively simple and can just be copied from below.

require("dotenv").config()
const fs = require("node:fs");
const yaml = require("js-yaml");
const load = require("@utils/handlers");
const yamlData = fs.readFileSync("./config/ConfigFile.yml","utf8");
const config = yaml.load(yamlData);

module.exports = {
  name: "ModuleName",
  description: "Your modules description.",
  enabled: config.enabled,
  emoji: "🤖",
  packages: ["discord.js"],

  execute(client, commmands) {
      load.handleCommands(this.name, commmands, this.enabled);
      load.handleEvents(this.name, client, this.enabled);
    },
};
PreviousGetting started as a developer

Last updated 9 months ago