Class GenericGuildInviteEvent
- java.lang.Object
-
- net.dv8tion.jda.api.events.Event
-
- net.dv8tion.jda.api.events.guild.GenericGuildEvent
-
- net.dv8tion.jda.api.events.guild.invite.GenericGuildInviteEvent
-
- All Implemented Interfaces:
GenericEvent
- Direct Known Subclasses:
GuildInviteCreateEvent,GuildInviteDeleteEvent
public class GenericGuildInviteEvent extends GenericGuildEvent
Indicates that anInvitewas created or deleted in aGuild.
Every GuildInviteEvent is derived from this event and can be casted.Can be used to detect any GuildInviteEvent.
Requirements
These events require the
GUILD_INVITESintent to be enabled.
These events will only fire for invite events that occur in channels where you canMANAGE_CHANNEL.
-
-
Constructor Summary
Constructors Constructor Description GenericGuildInviteEvent​(JDA api, long responseNumber, java.lang.String code, GuildChannel channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CategorygetCategory()TheCategorythis invite points to.GuildChannelgetChannel()TheGuildChannelthis invite points to.ChannelTypegetChannelType()TheChannelTypefor of thechannelthis invite points to.java.lang.StringgetCode()The invite code.StageChannelgetStageChannel()TheStageChannelthis invite points to.StoreChannelgetStoreChannel()TheStoreChannelthis invite points to.TextChannelgetTextChannel()TheTextChannelthis invite points to.java.lang.StringgetUrl()The invite url.VoiceChannelgetVoiceChannel()TheVoiceChannelthis invite points to.-
Methods inherited from class net.dv8tion.jda.api.events.guild.GenericGuildEvent
getGuild
-
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
-
-
-
Constructor Detail
-
GenericGuildInviteEvent
public GenericGuildInviteEvent​(@Nonnull JDA api, long responseNumber, @Nonnull java.lang.String code, @Nonnull GuildChannel channel)
-
-
Method Detail
-
getCode
@Nonnull public java.lang.String getCode()
The invite code.
This can be converted to a url withdiscord.gg/<code>.- Returns:
- The invite code
-
getUrl
@Nonnull public java.lang.String getUrl()
The invite url.
This uses thehttps://discord.gg/<code>format.- Returns:
- The invite url
-
getChannel
@Nonnull public GuildChannel getChannel()
TheGuildChannelthis invite points to.- Returns:
GuildChannel
-
getChannelType
@Nonnull public ChannelType getChannelType()
TheChannelTypefor of thechannelthis invite points to.- Returns:
ChannelType
-
getTextChannel
@Nonnull public TextChannel getTextChannel()
TheTextChannelthis invite points to.- Returns:
TextChannel- Throws:
java.lang.IllegalStateException- If this did not happen in a channel of typeChannelType.TEXT- See Also:
getChannel(),getChannelType()
-
getVoiceChannel
@Nonnull public VoiceChannel getVoiceChannel()
TheVoiceChannelthis invite points to.- Returns:
VoiceChannel- Throws:
java.lang.IllegalStateException- If this did not happen in a voice channel or stage channel- See Also:
getChannel(),getChannelType()
-
getStageChannel
@Nonnull public StageChannel getStageChannel()
TheStageChannelthis invite points to.- Returns:
StageChannel- Throws:
java.lang.IllegalStateException- If this did not happen in a channel of typeChannelType.STAGE- See Also:
getChannel(),getChannelType()
-
getStoreChannel
@Nonnull public StoreChannel getStoreChannel()
TheStoreChannelthis invite points to.- Returns:
StoreChannel- Throws:
java.lang.IllegalStateException- If this did not happen in a channel of typeChannelType.STORE- See Also:
getChannel(),getChannelType()
-
getCategory
@Nonnull public Category getCategory()
TheCategorythis invite points to.- Returns:
Category- Throws:
java.lang.IllegalStateException- If this did not happen in a channel of typeChannelType.CATEGORY- See Also:
getChannel(),getChannelType()
-
-