Class GuildJda

  • All Implemented Interfaces:
    Restriction<Message>

    public abstract class GuildJda
    extends Object
    implements Restriction<Message>
    A restriction that allows a command in certain guilds and is evaluated by the JDA command handler. To use it, create a trivial subclass of this class and make it a discoverable CDI bean, for example by annotating it with @ApplicationScoped.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GuildJda​(long guildId)
      Constructs a new guild restriction for checking the guild ID.
      protected GuildJda​(String guildName)
      Constructs a new guild restriction for checking the guild name case-sensitively against a fixed name.
      protected GuildJda​(String guildName, boolean caseSensitive)
      Constructs a new guild restriction for checking the guild name against a fixed name.
      protected GuildJda​(Pattern guildPattern)
      Constructs a new guild restriction for checking the guild name against a regular expression.
    • Constructor Detail

      • GuildJda

        protected GuildJda​(long guildId)
        Constructs a new guild restriction for checking the guild ID.
        Parameters:
        guildId - the ID of the guild where a command should be allowed
      • GuildJda

        protected GuildJda​(String guildName)
        Constructs a new guild restriction for checking the guild name case-sensitively against a fixed name.
        Parameters:
        guildName - the case-sensitive name of the guild where a command should be allowed
      • GuildJda

        protected GuildJda​(String guildName,
                           boolean caseSensitive)
        Constructs a new guild restriction for checking the guild name against a fixed name.
        Parameters:
        guildName - the name of the guild where a command should be allowed
        caseSensitive - whether the name should be matched case-sensitively or not
      • GuildJda

        protected GuildJda​(Pattern guildPattern)
        Constructs a new guild restriction for checking the guild name against a regular expression.
        Parameters:
        guildPattern - the pattern against which the guild name is matched to determine where a command should be allowed
    • Method Detail

      • allowCommand

        public boolean allowCommand​(CommandContext<? extends Message> commandContext)
        Description copied from interface: Restriction
        Returns whether a command caused by the given command context should be allowed by this restriction or not.
        Specified by:
        allowCommand in interface Restriction<Message>
        Parameters:
        commandContext - the command context, usually fully populated
        Returns:
        whether a command caused by the given command context should be allowed by this restriction or not