mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-25 22:37:03 -04:00
resolves an issue with timeouts that seem to apply to bots now.
This commit is contained in:
parent
8b77808950
commit
47f09fefbd
1 changed files with 21 additions and 1 deletions
|
@ -50,7 +50,27 @@ const commandClient = new CommandClient(cluster, {
|
||||||
ratelimits: [
|
ratelimits: [
|
||||||
{duration: 60000, limit: 50, type: 'guild'},
|
{duration: 60000, limit: 50, type: 'guild'},
|
||||||
{duration: 5000, limit: 5, type: 'channel'},
|
{duration: 5000, limit: 5, type: 'channel'},
|
||||||
]
|
],
|
||||||
|
onCommandCheck: async (context, command) => {
|
||||||
|
/*
|
||||||
|
I don't know why, I don't know since when - but timeouts apply to bots now.
|
||||||
|
This code checks if the bot is currently timed out, preventing any and all
|
||||||
|
commands from being executed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Only apply filters below to a GUILD context.
|
||||||
|
if(!context.guild) return true;
|
||||||
|
|
||||||
|
let b = context.guild.members.get(context.client.user.id);
|
||||||
|
// Bot member is not cached for whatever reason, fetch it.
|
||||||
|
if(b === undefined) b = await context.guild.fetchMember(context.client.user.id);
|
||||||
|
|
||||||
|
// Bot is timed out. Do not run anything until no longer timed out.
|
||||||
|
if(b.communicationDisabledUntil !== null) return false;
|
||||||
|
|
||||||
|
// Command should be fine to run.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const interactionClient = new InteractionCommandClient(cluster, {
|
const interactionClient = new InteractionCommandClient(cluster, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue