Class GenericInteractionCreateEvent
- java.lang.Object
-
- net.dv8tion.jda.api.events.Event
-
- net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
-
- All Implemented Interfaces:
ISnowflake,GenericEvent,Interaction
- Direct Known Subclasses:
GenericAutoCompleteInteractionEvent,GenericCommandInteractionEvent,GenericComponentInteractionCreateEvent
public class GenericInteractionCreateEvent extends Event implements Interaction
Indicates that anInteractionwas created.
Every interaction event is derived from this event.Requirements
To receive these events, you must unset the Interactions Endpoint URL in your application dashboard. You can simply remove the URL for this endpoint in your settings at the Discord Developers Portal.- See Also:
Interaction
-
-
Constructor Summary
Constructors Constructor Description GenericInteractionCreateEvent(JDA api, long responseNumber, Interaction interaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelgetChannel()The channel this interaction happened in.GuildgetGuild()TheGuildthis interaction happened in.LocalegetGuildLocale()Returns the preferred language of the Guild.longgetIdLong()The Snowflake id of this entity.InteractiongetInteraction()TheInteractioninstance.MembergetMember()TheMemberwho caused this interaction.StringgetToken()The interaction token used for responding to an interaction.intgetTypeRaw()The raw interaction type.UsergetUser()TheUserwho caused this interaction.LocalegetUserLocale()Returns the selected language of the invoking user.booleanisAcknowledged()Whether this interaction has already been acknowledged.-
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannelType, getGuildChannel, getJDA, getMessageChannel, getNewsChannel, getPrivateChannel, getTextChannel, getThreadChannel, getType, getVoiceChannel, isFromGuild
-
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
-
-
-
-
Constructor Detail
-
GenericInteractionCreateEvent
public GenericInteractionCreateEvent(@Nonnull JDA api, long responseNumber, @Nonnull Interaction interaction)
-
-
Method Detail
-
getInteraction
@Nonnull public Interaction getInteraction()
TheInteractioninstance.
Note that this event is a delegate which implements the same interface.- Returns:
- The
Interaction
-
getToken
@Nonnull public String getToken()
Description copied from interface:InteractionThe interaction token used for responding to an interaction.- Specified by:
getTokenin interfaceInteraction- Returns:
- The interaction token
-
getTypeRaw
public int getTypeRaw()
Description copied from interface:InteractionThe raw interaction type.
It is recommended to useInteraction.getType()instead.- Specified by:
getTypeRawin interfaceInteraction- Returns:
- The raw interaction type
-
getGuild
@Nullable public Guild getGuild()
Description copied from interface:InteractionTheGuildthis interaction happened in.
This is null in direct messages.- Specified by:
getGuildin interfaceInteraction- Returns:
- The
Guildor null
-
getChannel
@Nullable public Channel getChannel()
Description copied from interface:InteractionThe channel this interaction happened in.
This is currently never null, but might be nullable in the future.- Specified by:
getChannelin interfaceInteraction- Returns:
- The channel or null if this interaction is not from a channel context
-
getUserLocale
@Nonnull public Locale getUserLocale()
Description copied from interface:InteractionReturns the selected language of the invoking user.- Specified by:
getUserLocalein interfaceInteraction- Returns:
- The language of the invoking user
-
getGuildLocale
@Nonnull public Locale getGuildLocale()
Description copied from interface:InteractionReturns the preferred language of the Guild.
This is identical togetGuild().getLocale().- Specified by:
getGuildLocalein interfaceInteraction- Returns:
- The preferred language of the Guild
-
getMember
@Nullable public Member getMember()
Description copied from interface:InteractionTheMemberwho caused this interaction.
This is null if the interaction is not from a guild.- Specified by:
getMemberin interfaceInteraction- Returns:
- The
Member
-
getUser
@Nonnull public User getUser()
Description copied from interface:InteractionTheUserwho caused this interaction.- Specified by:
getUserin interfaceInteraction- Returns:
- The
User
-
getIdLong
public long getIdLong()
Description copied from interface:ISnowflakeThe Snowflake id of this entity. This is unique to every entity and will never change.- Specified by:
getIdLongin interfaceISnowflake- Returns:
- Long containing the Id.
-
isAcknowledged
public boolean isAcknowledged()
Description copied from interface:InteractionWhether this interaction has already been acknowledged.
Each interaction can only be acknowledged once.- Specified by:
isAcknowledgedin interfaceInteraction- Returns:
- True, if this interaction has already been acknowledged
-
-