Class GenericChannelEvent
java.lang.Object
net.dv8tion.jda.api.events.Event
net.dv8tion.jda.api.events.channel.GenericChannelEvent
- All Implemented Interfaces:
GenericEvent
- Direct Known Subclasses:
ChannelCreateEvent
,ChannelDeleteEvent
,GenericChannelUpdateEvent
Top-level channel event type
All channel events JDA fires are derived from this class.
All channel events JDA fires are derived from this class.
Can be used to check if an Object is a JDA event in EventListener
implementations to distinguish what event is being fired.
Adapter implementation: ListenerAdapter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionTheChannel
the event was fired from.TheChannelType
of the channel the event was fired from.getGuild()
TheGuild
in which this channel event happened.boolean
Whether this channel event happened in aGuild
.boolean
isFromType
(ChannelType type) Used to determine if this event was received from aChannel
of theChannelType
specified.Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getRawData, getResponseNumber, toString
-
Constructor Details
-
GenericChannelEvent
-
-
Method Details
-
isFromGuild
public boolean isFromGuild()Whether this channel event happened in aGuild
.
If this isfalse
thengetGuild()
will throw anIllegalStateException
.- Returns:
- True, if
getChannelType()
.isGuild()
is true.
-
getChannelType
TheChannelType
of the channel the event was fired from.- Returns:
- The
ChannelType
of the channel the event was fired from.
-
isFromType
Used to determine if this event was received from aChannel
of theChannelType
specified.Useful for restricting functionality to a certain type of channels.
- Parameters:
type
- TheChannelType
to check against.- Returns:
- True if the
ChannelType
which this message was received from is the same as the one specified bytype
.
-
getChannel
TheChannel
the event was fired from.- Returns:
- The
ChannelType
of the channel the event was fired from.
-
getGuild
TheGuild
in which this channel event happened.
If this channel event was not received in aGuildChannel
, this will throw anIllegalStateException
.- Returns:
- The Guild in which this channel event happened
- Throws:
IllegalStateException
- If this channel event did not happen in aGuildChannel
.- See Also:
-