Skip to content

Commit

Permalink
Update CooldownAttribute.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jan 16, 2024
1 parent 2ec758b commit 520ac87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DisCatSharp.CommandsNext/Attributes/CooldownAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ public override async Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help

var bid = this.GetBucketId(ctx, out var usr, out var chn, out var gld);
if (ctx.Client.CommandCooldownBuckets.TryGetValue(bid, out var bucket))
return await bucket.DecrementUseAsync(ctx).ConfigureAwait(false);
return await this.RespondRatelimitHitAsync(ctx, await bucket.DecrementUseAsync(ctx), bucket);

bucket = new(this.MaxUses, this.Reset, ctx.Command.QualifiedName, "text", usr, chn, gld);
ctx.Client.CommandCooldownBuckets.AddOrUpdate(bid, bucket, (k, v) => bucket);

return await bucket.DecrementUseAsync(ctx).ConfigureAwait(false);
return await this.RespondRatelimitHitAsync(ctx, await bucket.DecrementUseAsync(ctx), bucket);
}

/// <inheritdoc/>
Expand Down

0 comments on commit 520ac87

Please sign in to comment.