Class UserJavacordSlash

    • Constructor Detail

      • UserJavacordSlash

        protected UserJavacordSlash​(long userId)
        Constructs a new user restriction for checking the user ID.
        Parameters:
        userId - the ID of the user for whom a command should be allowed
      • UserJavacordSlash

        protected UserJavacordSlash​(String userName)
        Constructs a new user restriction for checking the user name case-sensitively against a fixed name.
        Parameters:
        userName - the case-sensitive name of the user for whom a command should be allowed
      • UserJavacordSlash

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

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

      • allowCommand

        public boolean allowCommand​(CommandContext<? extends SlashCommandInteraction> 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<SlashCommandInteraction>
        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