Skip to content

Re-factor bot.js, level of abstraction, extract code into library functions #23

Description

@Nos78

Background

There is some code in bot.js that should be extracted into new (or existing) libraries.

Modular command system

When the bot loads, the modular command system loads the commands from disk collates them into a collection. This is currently done within the main bot code, in bot.js. During development, if command files are modified, the bot has to be restarted.

Since the command system is supposed to be modular, one would be forgiven for thinking this means that commands are plug and play - you just drop a new file into the commands folder and a new command is accessible via discord. But that is not the case.

New functionality
However, if the command initialisation code where extracted into a library, a new command to reinitialise the bot could be created - meaning commands could be updated at runtime, and the bot would not have to be restarted every time there is a change to a command.

Alternatively, there are a range of events that could be hooked - one of these might be able to perform a similar task.

Pretty stack traces

There is some code that outputs a stack trace to the channel if an error is caught. This code should be extracted into a library function, so it can be used elsewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions