Package me.s3ns3iw00.jcommands
Class CommandHandler
- java.lang.Object
-
- me.s3ns3iw00.jcommands.CommandHandler
-
public class CommandHandler extends java.lang.Object
The main class of the API
-
-
Constructor Summary
Constructors Constructor Description CommandHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.javacord.api.DiscordApi
getApi()
static java.util.List<Command>
getCommands()
static java.util.List<Command>
getCommands(org.javacord.api.entity.server.Server server)
static boolean
isCommandExist(java.lang.String cmd)
Determines that a command with the given name is already exist or notstatic boolean
isCommandExist(org.javacord.api.entity.server.Server server, java.lang.String cmd)
Determines that a command with the given name is already exist or not on the specified serverstatic void
registerArgumentConverter(java.lang.Class<?> clazz, ArgumentResultConverter converter)
Deprecated.static void
registerCommand(GlobalCommandBuilder builder)
Calls theregisterCommand(GlobalCommand)
method with the command contained by theGlobalCommandBuilder
classstatic void
registerCommand(ServerCommandBuilder builder, org.javacord.api.entity.server.Server... servers)
Calls theregisterCommand(ServerCommand, Server...)
method with the command contained by theServerCommandBuilder
classstatic void
registerCommand(GlobalCommand command)
Registers command globally That means the command will be available in all the servers where the bot on, and also can be available in dms Sets up permissions with discord's default permission systemstatic void
registerCommand(ServerCommand command, org.javacord.api.entity.server.Server... servers)
Registers the command for the listener on the specified servers and sets up permissions with discord's default permission systemstatic void
setApi(org.javacord.api.DiscordApi api)
Initiates the command listener
-
-
-
Method Detail
-
setApi
public static void setApi(org.javacord.api.DiscordApi api)
Initiates the command listener- Parameters:
api
- is the instance of the Discord api
-
registerCommand
public static void registerCommand(ServerCommand command, org.javacord.api.entity.server.Server... servers)
Registers the command for the listener on the specified servers and sets up permissions with discord's default permission system- Parameters:
command
- the commandservers
- the list of the servers where the command will be registered
-
registerCommand
public static void registerCommand(GlobalCommand command)
Registers command globally That means the command will be available in all the servers where the bot on, and also can be available in dms Sets up permissions with discord's default permission system- Parameters:
command
- the command to register
-
registerCommand
public static void registerCommand(ServerCommandBuilder builder, org.javacord.api.entity.server.Server... servers)
Calls theregisterCommand(ServerCommand, Server...)
method with the command contained by theServerCommandBuilder
class- Parameters:
builder
- the builderservers
- the list of the servers where the command will be registered
-
registerCommand
public static void registerCommand(GlobalCommandBuilder builder)
Calls theregisterCommand(GlobalCommand)
method with the command contained by theGlobalCommandBuilder
class- Parameters:
builder
- the builder
-
getCommands
public static java.util.List<Command> getCommands()
- Returns:
- the list of the commands
-
getCommands
public static java.util.List<Command> getCommands(org.javacord.api.entity.server.Server server)
- Parameters:
server
- server- Returns:
- the list of the commands on the specified server
-
isCommandExist
public static boolean isCommandExist(java.lang.String cmd)
Determines that a command with the given name is already exist or not- Parameters:
cmd
- the command's name- Returns:
- exist or not
-
isCommandExist
public static boolean isCommandExist(org.javacord.api.entity.server.Server server, java.lang.String cmd)
Determines that a command with the given name is already exist or not on the specified server- Parameters:
server
- servercmd
- the command's name- Returns:
- exist or not
-
registerArgumentConverter
@Deprecated public static void registerArgumentConverter(java.lang.Class<?> clazz, ArgumentResultConverter converter)
Deprecated.Registers a converter for the given type- Parameters:
clazz
- the class of the typeconverter
- the converter
-
getApi
public static org.javacord.api.DiscordApi getApi()
- Returns:
- the discord api
-
-