DefaultRateLimitHandler

class DefaultRateLimitHandler(scope: RateLimitScope, deleteOnRefill: Boolean = true) : RateLimitHandler(source)

Default RateLimitHandler implementation based on rate limit scopes.

  • Text command rate limits are sent to the user in the event's channel, if the bot cannot talk, then it is sent to the user's DMs, or returns if not possible.

  • Interactions are simply replying an ephemeral message to the user.

All messages sent to the user are localized messages from DefaultMessages and will be deleted when expired.

Note: The rate limit message won't be deleted in a private channel, or if the refill delay is longer than 10 minutes.

Parameters

scope

Scope of the rate limit, see RateLimitScope values.

deleteOnRefill

Whether the rate limit message should be deleted after the refill delay.

See also

Constructors

Link copied to clipboard
constructor(scope: RateLimitScope, deleteOnRefill: Boolean = true)

Functions

Link copied to clipboard
open suspend override fun <T : GenericCommandInteractionEvent, IReplyCallback> onRateLimit(context: BContext, event: T, commandInfo: ApplicationCommandInfo, probe: ConsumptionProbe)
open suspend override fun onRateLimit(context: BContext, event: MessageReceivedEvent, commandInfo: TextCommandInfo, probe: ConsumptionProbe)