Closed cchudant closed 6 years ago
Unresolved question, should we still run the command if the option is on and the prefix is the bot's prefix (i.e. /
) ?
we should enable the developer to disable prefix by setting it to a falsy value -- ''
, null
or whatever
I thought of something like this
@command(/^command$/i, {
name: 'Command',
desc: 'Description',
prefix: Mode.MENTION_ONLY
})
Where Mode
is
const Mode = {
PREFIX: Symbol('Prefix'),
MENTION: Symbol('Prefix and Mentions'),
MENTION_ONLY: Symbol('Mentions only')
}
this should be configurable not inside the module but in the global config of the bot, no?
I think, we could simplify this a lot Just let the prefix take an array, of string or functions
prefix: ["/", ({ client }) => `${client.user} `]
And let this global setting, be overriden by a command
@command(/^command$/i, {
name: 'Command',
desc: 'Description',
prefix: ["/", ({ client }) => `${client.user} `]
})
And that can also be a function
@command(/^command$/i, {
name: 'Command',
desc: 'Description',
prefix: ({ client }) => client.settings.prefix.concat([({ client }) => `${client.user} `])
})
we need the length to remove from the message in order to pass it to the regexes
add a configuration option
mentionIsPrefix
to allow the bot to trigger commands when the prefix of the command is the bot's mention