From abc078eab8d4d0199bf4aa287de67f371d433893 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Wed, 1 Feb 2023 16:56:24 -0800 Subject: [PATCH] delay updating slash commands --- events/ready.js | 4 ++-- structures/LinesPoliceCadBot.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/events/ready.js b/events/ready.js index cd7f75b..d571889 100644 --- a/events/ready.js +++ b/events/ready.js @@ -6,5 +6,5 @@ module.exports = async (client) => { ) client.log(`Successfully Logged in as ${client.user.tag}`); // You can change the text if you want, but DO NOT REMOVE "client.user.tag" client.log(`Ready to serve in ${client.channels.cache.size} channels on ${client.guilds.cache.size} servers, for a total of ${client.users.cache.size} users.`) - // client.RegisterSlashCommands(); -}; \ No newline at end of file + client.RegisterSlashCommands(); +}; diff --git a/structures/LinesPoliceCadBot.js b/structures/LinesPoliceCadBot.js index 3c7bddb..34a1494 100644 --- a/structures/LinesPoliceCadBot.js +++ b/structures/LinesPoliceCadBot.js @@ -218,8 +218,14 @@ class LinesPoliceCadBot extends Client { } RegisterSlashCommands() { + let p = Promise.resolve() this.guilds.cache.forEach((guild) => { - require("../util/RegisterSlashCommands")(this, guild.id); + p = promise.then(() => { + require("../util/RegisterSlashCommands")(this, guild.id); + return new Promise((resolve) => { + setTimeout(resolve, 1000); + }) + }) }); }