Class CommandShutdown


  • @CommandAliases("shutdown")
    @MarkGuildOnly
    public class CommandShutdown
    extends Command
    Represents a shutdown command. Due to okhttp bug the shutdown isn't being properly executed by JDA.shutdown() and so some okhttp threads get left causing the bot to not stop so not save any prefixes or such and so this is why this command was born. You should register it by yourself and so this is why no settings are being present about it into CommandSettings
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandShutdown​(@NotNull java.lang.String botOwnerId)
      Creates a new shutdown command instance
    • Constructor Detail

      • CommandShutdown

        public CommandShutdown​(@NotNull
                               @NotNull java.lang.String botOwnerId)
        Creates a new shutdown command instance
        Parameters:
        botOwnerId - the discord user id, owner of this bot (the only one who can execute this command)
    • Method Detail

      • hasPermission

        public boolean hasPermission​(@NotNull
                                     @NotNull PermissionCheckContext context)
        An overridable method which checks if the member has the required permission to execute the command.
        Overrides:
        hasPermission in class Command
        Parameters:
        context - permission check context
        Returns:
        true if has, false otherwise
      • execute

        public boolean execute​(@NotNull
                               @NotNull CommandExecutionContext context,
                               @NotNull
                               @NotNull CommandArguments args)
        JDCF calls this method when the command was triggered from a message. This will always happen when the command name was prefixed with the bot's prefix. According to settings in CommandManager it also might happen when the bot was mentioned except of the bot prefix. Also according to settings in CommandManager prefixes may vary between servers.
        Specified by:
        execute in class Command
        Parameters:
        context - data about the trigger
        args - the arguments typed when triggered
        Returns:
        command execution success state