Class BaseActorJDA

java.lang.Object
revxrsal.commands.jda.core.BaseActorJDA
All Implemented Interfaces:
CommandActor, JDAActor

public final class BaseActorJDA extends Object implements JDAActor
  • Constructor Details

    • BaseActorJDA

      public BaseActorJDA(net.dv8tion.jda.api.events.message.MessageReceivedEvent event, CommandHandler handler)
  • Method Details

    • getName

      @NotNull public @NotNull String getName()
      Description copied from interface: CommandActor
      Returns the name of this actor. Varies depending on the platform.
      Specified by:
      getName in interface CommandActor
      Returns:
      The actor name
    • getUniqueId

      @NotNull public @NotNull UUID getUniqueId()
      Description copied from interface: CommandActor
      Returns the unique UID of this subject. Varies depending on the platform.

      Although some platforms explicitly have their underlying senders have UUIDs, some platforms may have to generate this UUID based on other available data.

      Specified by:
      getUniqueId in interface CommandActor
      Returns:
      The UUID of this subject.
    • reply

      public void reply(@NotNull @NotNull String message)
      Description copied from interface: CommandActor
      Replies to the sender with the specified message.

      Varies depending on the platform.

      Specified by:
      reply in interface CommandActor
      Parameters:
      message - Message to reply with.
    • error

      public void error(@NotNull @NotNull String message)
      Description copied from interface: CommandActor
      Replies to the sender with the specified message, and marks it as an error depending on the platform.

      Note that, in certain platforms where no "error" mode is available, this may effectively be equivilent to calling CommandActor.reply(String).

      This method should not throw any exceptions.

      Specified by:
      error in interface CommandActor
      Parameters:
      message - Message to reply with
    • getCommandHandler

      public CommandHandler getCommandHandler()
      Description copied from interface: CommandActor
      Returns the command handler that constructed this actor
      Specified by:
      getCommandHandler in interface CommandActor
      Returns:
      The command handler
    • getMember

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

      public JDAActor checkInGuild(ExecutableCommand command)
      Description copied from interface: JDAActor
      Returns this actor if it is in a guild, otherwise throws a GuildOnlyCommandException.
      Specified by:
      checkInGuild in interface JDAActor
      Parameters:
      command - Command to check for.
      Returns:
      This actor
    • checkNotInGuild

      public JDAActor checkNotInGuild(ExecutableCommand command) throws PrivateMessageOnlyCommandException
      Description copied from interface: JDAActor
      Returns this actor if it is not in a guild, otherwise throws a PrivateMessageOnlyCommandException.
      Specified by:
      checkNotInGuild in interface JDAActor
      Parameters:
      command - Command to check for.
      Returns:
      This actor
      Throws:
      PrivateMessageOnlyCommandException
    • getMessage

      @NotNull public @NotNull net.dv8tion.jda.api.entities.Message getMessage()
      Description copied from interface: JDAActor
      Returns the message of the actor
      Specified by:
      getMessage in interface JDAActor
      Returns:
      The actor's sent message
    • getEvent

      @NotNull public @NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent getEvent()
      Description copied from interface: JDAActor
      Returns the MessageReceivedEvent that created this actor
      Specified by:
      getEvent in interface JDAActor
      Returns:
      The event
    • getIdLong

      public long getIdLong()
      Description copied from interface: JDAActor
      Returns the snowflake ID of this actor
      Specified by:
      getIdLong in interface JDAActor
      Returns:
      The snowflake ID
    • getId

      @NotNull public @NotNull String getId()
      Description copied from interface: JDAActor
      Returns the snowflake ID of this actor as a string.
      Specified by:
      getId in interface JDAActor
      Returns:
      The snowflake ID
    • getUser

      @NotNull public @NotNull net.dv8tion.jda.api.entities.User getUser()
      Description copied from interface: JDAActor
      Returns the underlying User of this actor
      Specified by:
      getUser in interface JDAActor
      Returns:
      The underlying user
    • getGuild

      @NotNull public @NotNull net.dv8tion.jda.api.entities.Guild getGuild()
      Description copied from interface: JDAActor
      Returns the guild of this actor, or throws a IllegalStateException if the command was not run in a guild.
      Specified by:
      getGuild in interface JDAActor
      Returns:
      The guild
    • getChannel

      @NotNull public @NotNull net.dv8tion.jda.api.entities.MessageChannel getChannel()
      Description copied from interface: JDAActor
      Returns the channel this actor sent the command in
      Specified by:
      getChannel in interface JDAActor
      Returns:
      The channel
    • isGuildEvent

      public boolean isGuildEvent()
      Description copied from interface: JDAActor
      Returns whether this actor sent a command in a guild or not
      Specified by:
      isGuildEvent in interface JDAActor
      Returns:
      If this command was run in a guild