Discord bot that does a lot of weird/interesting math
- In
commands.jsgo toconst reqFilesand add the name of the new module as akey: valuepair into the Object wherekeyis the global variable you want to use andvalueis the file name for the new module. For examplenpc: "npc.js" - In your new module, the first line should be
var bot = process.DiscordBot;. - If there are subcommands associated with this module:
- Create a function and name it
<global variable of module>Check(){}- For example, my
admin.jsfile hasadminCheck(). - Make sure to put in any parameters needed, usually msg and the object
message.
- For example, my
- Use a
switch caseblock in the newly created check function to test for subcommands
- Create a function and name it
- At the bottom of the file insert this:
var <var> = {
<check function name>: <check function name>
[, <any other functions to export>: <any other functions to export>]
}
module.exports = <var>;