Class SlashCommandEvent
- java.lang.Object
-
- discord4j.core.event.domain.Event
-
- discord4j.core.event.domain.interaction.InteractionCreateEvent
-
- discord4j.core.event.domain.interaction.SlashCommandEvent
-
@Experimental public class SlashCommandEvent extends InteractionCreateEvent
Dispatched when a user in a guild uses a Slash Command.This event is dispatched by Discord.
- See Also:
- Interaction Create
-
-
Constructor Summary
Constructors Constructor Description SlashCommandEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Snowflake
getCommandId()
Gets the ID of the invoked command.String
getCommandName()
Gets the name of the invoked command.Optional<ApplicationCommandInteractionOption>
getOption(String name)
Gets the option corresponding to the provided name, if present.List<ApplicationCommandInteractionOption>
getOptions()
Gets the options of the invoked command.-
Methods inherited from class discord4j.core.event.domain.interaction.InteractionCreateEvent
acknowledge, acknowledgeEphemeral, createInteractionResponse, getInteraction, getInteractionResponse, reply, reply, reply, reply
-
Methods inherited from class discord4j.core.event.domain.Event
getClient, getShardInfo
-
-
-
-
Constructor Detail
-
SlashCommandEvent
public SlashCommandEvent(GatewayDiscordClient gateway, ShardInfo shardInfo, Interaction interaction)
-
-
Method Detail
-
getCommandId
public Snowflake getCommandId()
Gets the ID of the invoked command.- Returns:
- The ID of the invoked command.
-
getCommandName
public String getCommandName()
Gets the name of the invoked command.- Returns:
- The name of the invoked command.
-
getOptions
public List<ApplicationCommandInteractionOption> getOptions()
Gets the options of the invoked command.- Returns:
- The options of the invoked command.
-
getOption
public Optional<ApplicationCommandInteractionOption> getOption(String name)
Gets the option corresponding to the provided name, if present.- Parameters:
name
- The name of the option.- Returns:
- The option corresponding to the provided name, if present.
-
-