fix(command): 🐛 fix bot address regex returning undefined
Waits till spawn to make sure `bot.username` is definitely initialized
This commit is contained in:
+1
-1
@@ -88,7 +88,6 @@ fs.watch('./lib/plugins', reloadplugin)
|
||||
cfg.bot = bot
|
||||
// TODO better name, or switch to array
|
||||
cfg.botAddressPrefix = '!'
|
||||
cfg.botAddressRegex = new RegExp(`^${bot.username} (${cfg.botAddressPrefix}.+)`)
|
||||
cfg.quiet = true
|
||||
|
||||
|
||||
@@ -110,6 +109,7 @@ bot.once("spawn", () => {
|
||||
}
|
||||
|
||||
cfg.plugins = plugins
|
||||
cfg.botAddressRegex = new RegExp(`^${bot.username} (${cfg.botAddressPrefix}.+)`)
|
||||
|
||||
for (const plugin of Object.values(plugins)) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user