Skip to content

Commit

Permalink
Do not check cooldown if none is set
Browse files Browse the repository at this point in the history
Fixes false warnings
  • Loading branch information
freya022 committed Apr 24, 2024
1 parent f1089a4 commit 75aaeb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ private boolean canRun(@NotNull GenericCommandInteractionEvent event, Applicatio
}
}

if (isNotOwner) {
final long cooldown = applicationCommand.getCooldown(event, event::getName);
if (isNotOwner && applicationCommand.getCooldownMillis() > 0) {
final long cooldown = applicationCommand.getCooldown(event, event::getFullCommandName);
if (cooldown > 0) {
final DefaultMessages messages = this.context.getDefaultMessages(event);
if (applicationCommand.getCooldownScope() == CooldownScope.USER) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private ExecutionResult tryExecute(MessageReceivedEvent event, Member member, bo
}
}

if (isNotOwner) {
if (isNotOwner && candidate.getCooldownMillis() > 0) {
final long cooldown = candidate.getCooldown(event);
if (cooldown > 0) {
final DefaultMessages messages = this.context.getDefaultMessages(event.getGuild());
Expand Down

0 comments on commit 75aaeb3

Please sign in to comment.