Class Context

java.lang.Object
com.reign.kat.lib.command.Context
Direct Known Subclasses:
ButtonInteractionContext, MessageContext, SlashCommandContext, VoiceContext

public abstract class Context extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final List<String>
    List of command arguments
    final net.dv8tion.jda.api.entities.Member
    Member who invoked the command
    final net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
    Guild TextChannel the command was sent in.
    final Command
    Invoked command
    final net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel
    PrivateChannel the command was sent in.
    final net.dv8tion.jda.api.entities.Guild
    Guild the command was sent in.
    final net.dv8tion.jda.api.JDA
     
    final net.dv8tion.jda.api.entities.channel.middleman.AudioChannel
    The VoiceChannel the author is in.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Context(VoiceCommandEvent event, Command command, List<String> args)
     
    Context(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event, Command command, List<String> args)
     
    Context(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event, Command command, List<String> args)
     
    Context(net.dv8tion.jda.api.events.message.MessageReceivedEvent event, Command command, List<String> args)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    net.dv8tion.jda.api.entities.channel.middleman.MessageChannel
     
    abstract net.dv8tion.jda.api.events.Event
     
    net.dv8tion.jda.api.interactions.InteractionHook
     
    boolean
     
    boolean
     
    abstract String
     
    void
    reply(String... msgs)
    Alias to send(String...
    void
    reply(net.dv8tion.jda.api.entities.MessageEmbed... embeds)
    Alias to send(MessageEmbed...
    abstract void
    send(String... msgs)
     
    abstract void
    send(net.dv8tion.jda.api.entities.MessageEmbed... embeds)
     
    void
    sendError(String... msgs)
    Reply to the user with a generic error embed
    void
    sendError(net.dv8tion.jda.api.entities.MessageEmbed... embeds)
    Reply to the user with error an embed(s)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • jda

      public final net.dv8tion.jda.api.JDA jda
    • args

      public final List<String> args
      List of command arguments
    • command

      public final Command command
      Invoked command
    • author

      public final net.dv8tion.jda.api.entities.Member author
      Member who invoked the command
    • channel

      public final net.dv8tion.jda.api.entities.channel.middleman.GuildChannel channel
      Guild TextChannel the command was sent in. null if not in a guild
    • dmChannel

      public final net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel dmChannel
      PrivateChannel the command was sent in. null if not in a DM
    • voiceChannel

      public final net.dv8tion.jda.api.entities.channel.middleman.AudioChannel voiceChannel
      The VoiceChannel the author is in. null if not in a voiceChannel / is a DM
    • guild

      public final net.dv8tion.jda.api.entities.Guild guild
      Guild the command was sent in. null if not in a guild
  • Constructor Details

    • Context

      public Context(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event, Command command, List<String> args)
    • Context

      public Context(net.dv8tion.jda.api.events.message.MessageReceivedEvent event, Command command, List<String> args)
    • Context

      public Context(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event, Command command, List<String> args)
    • Context

      public Context(VoiceCommandEvent event, Command command, List<String> args)
  • Method Details

    • event

      public abstract net.dv8tion.jda.api.events.Event event()
    • prefix

      public abstract String prefix()
    • send

      public abstract void send(String... msgs)
    • send

      public abstract void send(net.dv8tion.jda.api.entities.MessageEmbed... embeds)
    • canProvideInteractionHook

      public boolean canProvideInteractionHook()
    • hook

      public net.dv8tion.jda.api.interactions.InteractionHook hook()
    • reply

      public void reply(String... msgs)
      Alias to send(String... msgs)
      Parameters:
      msgs - String messages to send
    • reply

      public void reply(net.dv8tion.jda.api.entities.MessageEmbed... embeds)
      Alias to send(MessageEmbed... embeds)
      Parameters:
      embeds - MessageEmbed embeds to send
    • sendError

      public void sendError(String... msgs)
      Reply to the user with a generic error embed
    • sendError

      public void sendError(net.dv8tion.jda.api.entities.MessageEmbed... embeds)
      Reply to the user with error an embed(s)
    • channel

      public net.dv8tion.jda.api.entities.channel.middleman.MessageChannel channel()
    • isGuild

      public boolean isGuild()
    • isDM

      public boolean isDM()