Class ReplyableEvent<T extends net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent>
- All Implemented Interfaces:
Reply
,net.dv8tion.jda.api.entities.ISnowflake
,net.dv8tion.jda.api.interactions.Interaction
- Direct Known Subclasses:
ModalEvent
,ModalReplyableEvent
Subtype of Event
that supports replying to the GenericInteractionCreateEvent
with text messages.
You can either reply directly by using one of the reply
methods, like reply(String)
, or you can call
with()
to use a ConfigurableReply
to append components or override reply settings from the
ReplyConfig
.
Example:
public void onInteraction(ReplayableEvent<?> event) {
event.reply("Hello World");
}
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ReplyableEvent
(T event, InteractionRegistry interactionRegistry, Runtime runtime, InteractionDefinition definition, InteractionDefinition.ReplyConfig globalReplyConfig) Constructs a new ReplyableEvent. -
Method Summary
Modifier and TypeMethodDescription@NotNull net.dv8tion.jda.api.interactions.components.buttons.Button
Gets aButton
based on the method name and the given class and transforms it into a JDAButton
.@NotNull net.dv8tion.jda.api.interactions.components.buttons.Button
Gets aButton
based on the method name and transforms it into a JDAButton
.@NotNull net.dv8tion.jda.api.interactions.components.selections.SelectMenu
getSelectMenu
(@NotNull Class<?> origin, @NotNull String menu) Gets aStringSelectMenu
orEntitySelectMenu
based on the method name and transforms it into a JDASelectMenu
.@NotNull net.dv8tion.jda.api.interactions.components.selections.SelectMenu
getSelectMenu
(@NotNull String menu) Gets aStringSelectMenu
orEntitySelectMenu
based on the method name and transforms it into a JDASelectMenu
.void
Removes all components from the original message.@NotNull net.dv8tion.jda.api.entities.Message
Acknowledgement of this event with a text message.@NotNull net.dv8tion.jda.api.entities.Message
reply
(@NotNull net.dv8tion.jda.api.EmbedBuilder builder) Acknowledgement of this event with a text message.@NotNull net.dv8tion.jda.api.entities.Message
reply
(@NotNull net.dv8tion.jda.api.utils.messages.MessageCreateData message) Acknowledgement of this event with a text message.@NotNull ConfigurableReply
with()
Entry point for configuring a reply.Methods inherited from class com.github.kaktushose.jda.commands.dispatching.events.Event
closeRuntime, getChannel, getChannelIdLong, getEntitlements, getGuild, getIdLong, getJDA, getMember, getToken, getTypeRaw, getUser, getUserLocale, isAcknowledged, jdaEvent, kv, runtimeId
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannelId, getChannelType, getGuildChannel, getGuildLocale, getMessageChannel, getType, isFromGuild
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
-
Field Details
-
definition
-
-
Constructor Details
-
ReplyableEvent
protected ReplyableEvent(T event, InteractionRegistry interactionRegistry, Runtime runtime, InteractionDefinition definition, InteractionDefinition.ReplyConfig globalReplyConfig) Constructs a new ReplyableEvent.- Parameters:
event
- the subtypeReplyableEvent
ofGenericInteractionCreateEvent
interactionRegistry
- the correspondingInteractionRegistry
runtime
- theRuntime
this event lives indefinition
- theInteractionDefinition
this event belongs to
-
-
Method Details
-
removeComponents
public void removeComponents()Removes all components from the original message.
The original message is the message, from which this event (interaction) originates. For example if this event is a ButtonEvent, the original message will be the message to which the pressed button is attached to.
-
getButton
@NotNull public @NotNull net.dv8tion.jda.api.interactions.components.buttons.Button getButton(@NotNull @NotNull String button) Gets a
Button
based on the method name and transforms it into a JDAButton
.The button will be linked to the current
Runtime
. This may be useful if you want to send a component without using the framework.- Parameters:
button
- the name of the button defining method- Returns:
- the JDA
Button
-
getButton
@NotNull public @NotNull net.dv8tion.jda.api.interactions.components.buttons.Button getButton(@NotNull @NotNull Class<?> origin, @NotNull @NotNull String button) Gets a
Button
based on the method name and the given class and transforms it into a JDAButton
.The button will be
runtime
-independent. This may be useful if you want to send a component without using the framework.- Parameters:
origin
- theClass
of the methodbutton
- the name of the button defining method- Returns:
- the JDA
Button
-
getSelectMenu
@NotNull public @NotNull net.dv8tion.jda.api.interactions.components.selections.SelectMenu getSelectMenu(@NotNull @NotNull String menu) Gets a
StringSelectMenu
orEntitySelectMenu
based on the method name and transforms it into a JDASelectMenu
.The select menu will be linked to the current
Runtime
. This may be useful if you want to send a component without using the framework.- Parameters:
menu
- the name of the select menu- Returns:
- the JDA
SelectMenu
-
getSelectMenu
@NotNull public @NotNull net.dv8tion.jda.api.interactions.components.selections.SelectMenu getSelectMenu(@NotNull @NotNull Class<?> origin, @NotNull @NotNull String menu) Gets a
StringSelectMenu
orEntitySelectMenu
based on the method name and transforms it into a JDASelectMenu
.The select menu will be
runtime
-independent. This may be useful if you want to send a component without using the framework.- Parameters:
origin
- theClass
of the methodmenu
- the name of the select menu- Returns:
- the JDA
SelectMenu
-
with
Entry point for configuring a reply.
Returns a new
ConfigurableReply
that can be used to append components or override reply settings.- Returns:
- a new
ConfigurableReply
- See Also:
-
reply
-
reply
@NotNull public @NotNull net.dv8tion.jda.api.entities.Message reply(@NotNull @NotNull net.dv8tion.jda.api.utils.messages.MessageCreateData message) Description copied from interface:Reply
Acknowledgement of this event with a text message. -
reply
@NotNull public @NotNull net.dv8tion.jda.api.entities.Message reply(@NotNull @NotNull net.dv8tion.jda.api.EmbedBuilder builder) Description copied from interface:Reply
Acknowledgement of this event with a text message.
-