To write a module simply create a .js file inside the src/modules folder.
The basic structure of a module is
'use strict';
const DiscordBotModule = require('../discordBotModule.js');
module.exports = class JokeModule extends DiscordBotModule {
constructor(discordClient) {
let commands = ['command'];
super("[ModuleName]", commands, discordClient);
}
command(message, params) {
// YOUR CODE HERE
// You can access the discord client via this.discordClient
}
};
If you need a configuration file for your module we recommend
adding a .json file with the name of your module inside the modules folder.
You can then require
the config and use it.
const config = require('./moduleConfig.json');
Simply run npm install
Run the bot with node app.js
after installing the dependencies.