![JAR search and dependency download from the Maven repository](/logo.png)
io.github.freya022.botcommands.api.commands.ratelimit.handler.RateLimitHandler.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BotCommands Show documentation
Show all versions of BotCommands Show documentation
A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.
package io.github.freya022.botcommands.api.commands.ratelimit.handler
import io.github.bucket4j.ConsumptionProbe
import io.github.freya022.botcommands.api.core.BContext
import io.github.freya022.botcommands.internal.commands.application.ApplicationCommandInfo
import io.github.freya022.botcommands.internal.commands.text.TextCommandInfo
import net.dv8tion.jda.api.events.interaction.command.GenericCommandInteractionEvent
import net.dv8tion.jda.api.events.interaction.component.GenericComponentInteractionCreateEvent
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
import net.dv8tion.jda.api.interactions.callbacks.IMessageEditCallback
import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback
/**
* Defines the behavior when a rate limited is triggered.
*/
interface RateLimitHandler {
suspend fun onRateLimit(context: BContext, event: MessageReceivedEvent, commandInfo: TextCommandInfo, probe: ConsumptionProbe)
suspend fun onRateLimit(context: BContext, event: T, commandInfo: ApplicationCommandInfo, probe: ConsumptionProbe)
where T : GenericCommandInteractionEvent,
T : IReplyCallback
suspend fun onRateLimit(context: BContext, event: T, probe: ConsumptionProbe)
where T : GenericComponentInteractionCreateEvent,
T : IReplyCallback,
T : IMessageEditCallback
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy