Package revxrsal.commands.jda
Interface JDAActor
- All Superinterfaces:
CommandActor
- All Known Implementing Classes:
BaseActorJDA
Represents a JDA
CommandActor
that executes a command,
whether in a private message or a guild.-
Method Summary
Modifier and TypeMethodDescriptioncheckInGuild
(ExecutableCommand command) Returns this actor if it is in a guild, otherwise throws aGuildOnlyCommandException
.checkNotInGuild
(ExecutableCommand command) Returns this actor if it is not in a guild, otherwise throws aPrivateMessageOnlyCommandException
.@NotNull net.dv8tion.jda.api.entities.MessageChannel
Returns the channel this actor sent the command in@NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent
getEvent()
Returns theMessageReceivedEvent
that created this actor@NotNull net.dv8tion.jda.api.entities.Guild
getGuild()
Returns the guild of this actor, or throws aIllegalStateException
if the command was not run in a guild.@NotNull String
getId()
Returns the snowflake ID of this actor as a string.long
Returns the snowflake ID of this actor@NotNull net.dv8tion.jda.api.entities.Member
Returns theMember
of this actor.@NotNull net.dv8tion.jda.api.entities.Message
Returns the message of the actor@NotNull net.dv8tion.jda.api.entities.User
getUser()
Returns the underlyingUser
of this actorboolean
Returns whether this actor sent a command in a guild or notstatic @NotNull JDAActor
wrap
(@NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent event, @NotNull CommandHandler handler) Creates a newJDAActor
that wraps the givenMessageReceivedEvent
.Methods inherited from interface revxrsal.commands.command.CommandActor
as, error, errorLocalized, getCommandHandler, getLocale, getName, getTranslator, getUniqueId, reply, replyLocalized
-
Method Details
-
getIdLong
long getIdLong()Returns the snowflake ID of this actor- Returns:
- The snowflake ID
-
getId
Returns the snowflake ID of this actor as a string.- Returns:
- The snowflake ID
-
getUser
@NotNull @NotNull net.dv8tion.jda.api.entities.User getUser()Returns the underlyingUser
of this actor- Returns:
- The underlying user
-
getMessage
@NotNull @NotNull net.dv8tion.jda.api.entities.Message getMessage()Returns the message of the actor- Returns:
- The actor's sent message
-
getEvent
@NotNull @NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent getEvent()Returns theMessageReceivedEvent
that created this actor- Returns:
- The event
-
getChannel
@NotNull @NotNull net.dv8tion.jda.api.entities.MessageChannel getChannel()Returns the channel this actor sent the command in- Returns:
- The channel
-
isGuildEvent
boolean isGuildEvent()Returns whether this actor sent a command in a guild or not- Returns:
- If this command was run in a guild
-
getGuild
@NotNull @NotNull net.dv8tion.jda.api.entities.Guild getGuild()Returns the guild of this actor, or throws aIllegalStateException
if the command was not run in a guild.- Returns:
- The guild
-
getMember
@NotNull @NotNull net.dv8tion.jda.api.entities.Member getMember()Returns theMember
of this actor. This will throw an exception in case of private messages. Check withisGuildEvent()
.- Returns:
- the member of the actor
-
checkInGuild
Returns this actor if it is in a guild, otherwise throws aGuildOnlyCommandException
.- Parameters:
command
- Command to check for.- Returns:
- This actor
- Throws:
GuildOnlyCommandException
-
checkNotInGuild
Returns this actor if it is not in a guild, otherwise throws aPrivateMessageOnlyCommandException
.- Parameters:
command
- Command to check for.- Returns:
- This actor
- Throws:
PrivateMessageOnlyCommandException
-
wrap
@NotNull static @NotNull JDAActor wrap(@NotNull @NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent event, @NotNull @NotNull CommandHandler handler) Creates a newJDAActor
that wraps the givenMessageReceivedEvent
.- Parameters:
event
- Event to wrap- Returns:
- The wrapping
JDAActor
.
-