global command cooldown reduced to 750ms on self hosted (still 1500 on public bot). Global command cooldown no longer triggers on any message, only on command.
This commit is contained in:
parent
1c142a0fc5
commit
54ddab13c1
@ -30,7 +30,11 @@ namespace NadekoBot.Services
|
||||
}
|
||||
public class CommandHandler
|
||||
{
|
||||
#if GLOBAL_NADEKO
|
||||
public const int GlobalCommandsCooldown = 1500;
|
||||
#else
|
||||
public const int GlobalCommandsCooldown = 750;
|
||||
#endif
|
||||
|
||||
private readonly DiscordShardedClient _client;
|
||||
private readonly CommandService _commandService;
|
||||
@ -196,11 +200,6 @@ namespace NadekoBot.Services
|
||||
// track how many messagges each user is sending
|
||||
UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (key, old) => ++old);
|
||||
|
||||
// Bot will ignore commands which are ran more often than what specified by
|
||||
// GlobalCommandsCooldown constant (miliseconds)
|
||||
if (!UsersOnShortCooldown.Add(usrMsg.Author.Id))
|
||||
return;
|
||||
|
||||
var channel = msg.Channel as SocketTextChannel;
|
||||
var guild = channel?.Guild;
|
||||
|
||||
@ -367,9 +366,13 @@ namespace NadekoBot.Services
|
||||
}
|
||||
}
|
||||
|
||||
// Bot will ignore commands which are ran more often than what specified by
|
||||
// GlobalCommandsCooldown constant (miliseconds)
|
||||
if (!UsersOnShortCooldown.Add(context.Message.Author.Id))
|
||||
return new ExecuteCommandResult(cmd, null, SearchResult.FromError(CommandError.Exception, $"You are on a global cooldown."));
|
||||
|
||||
if (CmdCdsCommands.HasCooldown(cmd, context.Guild, context.User))
|
||||
return new ExecuteCommandResult(cmd, null, SearchResult.FromError(CommandError.Exception, $"That command is on cooldown for you."));
|
||||
return new ExecuteCommandResult(cmd, null, SearchResult.FromError(CommandError.Exception, $"That command is on a cooldown for you."));
|
||||
|
||||
return new ExecuteCommandResult(cmd, null, await commands[i].ExecuteAsync(context, parseResult, dependencyMap));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user