Interface JDAActor

All Superinterfaces:
CommandActor
All Known Implementing Classes:
BaseActorJDA

public interface JDAActor extends CommandActor
Represents a JDA CommandActor that executes a command, whether in a private message or a guild.
  • Method Details

    • getIdLong

      long getIdLong()
      Returns the snowflake ID of this actor
      Returns:
      The snowflake ID
    • getId

      @NotNull @NotNull String 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 underlying User 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 the MessageReceivedEvent 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 a IllegalStateException if the command was not run in a guild.
      Returns:
      The guild
    • getMember

      @NotNull @NotNull net.dv8tion.jda.api.entities.Member getMember()
      Returns the Member of this actor. This will throw an exception in case of private messages. Check with isGuildEvent().
      Returns:
      the member of the actor
    • checkInGuild

      Returns this actor if it is in a guild, otherwise throws a GuildOnlyCommandException.
      Parameters:
      command - Command to check for.
      Returns:
      This actor
      Throws:
      GuildOnlyCommandException
    • checkNotInGuild

      Returns this actor if it is not in a guild, otherwise throws a PrivateMessageOnlyCommandException.
      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 new JDAActor that wraps the given MessageReceivedEvent.
      Parameters:
      event - Event to wrap
      Returns:
      The wrapping JDAActor.