From 80ac62a80f61de35473436d0fda31d3fca4b5062 Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Sat, 7 Aug 2021 23:44:02 +0200 Subject: [PATCH] fixed guild specific commands --- src/Bot.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Bot.ts b/src/Bot.ts index 551b309..3c15f54 100644 --- a/src/Bot.ts +++ b/src/Bot.ts @@ -128,18 +128,11 @@ export class Bot extends EventEmitter { .filter((c) => !!c.guilds) .map((c) => { c.guilds?.map(async (g) => { - const guild = await this.client.guilds.fetch(g); - if (guild) { - if (guilds[guild.id]) { - guilds[guild.id].push( - c.toCommandObject() - ); - } else { - guilds[guild.id] = []; - guilds[guild.id].push( - c.toCommandObject() - ); - } + if (guilds[g]) { + guilds[g].push(c.toCommandObject()); + } else { + guilds[g] = []; + guilds[g].push(c.toCommandObject()); } }); }); @@ -217,7 +210,6 @@ export class Bot extends EventEmitter { i as CommandInteraction ); } - cmd = this.commands.fetchFromInteraction(i); } catch (e) { if (e instanceof PermissionsError) { await this.messages.system.send(