Closed MacND closed 5 years ago
I'm not sure how much confidence I have in this approach actually being better - from a code perspective it would probably be cleaner to import these utilities within message.js
. I'll need to think on this.
At the very least I want this stuff out of the client
object, even if that means using a utils
object to house them.
I'm so sick of trying to find a "solution" to this - all commands are being refactored to require
what they need, as they need it, and let caching do its job.
Current behaviour
At present, custom modules (db, moment etc.) are required in
main.js
and attached to the client object. This means calls to those modules are prepended withclient.
, why creates messy and confusing code.Desired behaviour
Custom modules should be required in a standard fashion, and then passed to the events as arguments in the bind command e.g.
Completion criteria
All
command
files will have theirrun
function declaration adjusted. Old:run: async (client, message, args) => {
New:run: async (client, message, args, db, moment) => {