Skip to content

Interactions

itsmefox edited this page Nov 25, 2022 · 12 revisions

Commands

Create a new command

All slash commands are handled with the abstract class DiscordCommand. To create a new command, you have to extend this class and set a unique name as well as a description.

@Interaction
class PingCommand : DiscordCommand("ping", "Send a ping command") {

    override fun execute(event: SlashCommandInteractionEvent) {
        //Reply to the user
        val startTime = System.currentTimeMillis()
        event.reply("Ping ...").setEphemeral(true).queue {
            it.editOriginal("Pong: ${System.currentTimeMillis() - startTime}ms").queue()
        }
    }
}

Registration / Update / Deletion of commands

Parameters

Sub-Commands & Sub-Command-Groups

Auto-Complete for Parameters

Spring Scope handling

Components handling

Translation

Context-Menus

Create a new context menu

Registration / Update / Deletion of context menus

Spring Scope handling

Components handling

Translation

Buttons

Utils

Select-Menus

Utils

Modals

Utils

Generic Auto-Complete Handler

Additional interaction handlers