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 anInvite
was 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_INVITES
intent 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 Category
getCategory()
TheCategory
this invite points to.GuildChannel
getChannel()
TheGuildChannel
this invite points to.ChannelType
getChannelType()
TheChannelType
for of thechannel
this invite points to.java.lang.String
getCode()
The invite code.StageChannel
getStageChannel()
TheStageChannel
this invite points to.StoreChannel
getStoreChannel()
TheStoreChannel
this invite points to.TextChannel
getTextChannel()
TheTextChannel
this invite points to.java.lang.String
getUrl()
The invite url.VoiceChannel
getVoiceChannel()
TheVoiceChannel
this 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()
TheGuildChannel
this invite points to.- Returns:
GuildChannel
-
getChannelType
@Nonnull public ChannelType getChannelType()
TheChannelType
for of thechannel
this invite points to.- Returns:
ChannelType
-
getTextChannel
@Nonnull public TextChannel getTextChannel()
TheTextChannel
this 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()
TheVoiceChannel
this 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()
TheStageChannel
this 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()
TheStoreChannel
this 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()
TheCategory
this invite points to.- Returns:
Category
- Throws:
java.lang.IllegalStateException
- If this did not happen in a channel of typeChannelType.CATEGORY
- See Also:
getChannel()
,getChannelType()
-
-