Package com.aliucord.api
Class CommandsAPI
-
- All Implemented Interfaces:
public class CommandsAPI
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
CommandsAPI.CommandResult
Command result
-
Field Summary
Fields Modifier and Type Field Description public final static long
ALIUCORD_APP_ID
public final static String
DONT_SEND_RESULT
public final static Application
aliucordApplication
public static Map<String, RemoteApplicationCommand>
commands
public static Map<String, String>
commandsAndPlugins
public static Map<Long, WidgetApplicationCommandBottomSheetViewModel.StoreState>
interactionsStore
public static ApplicationCommandOption
messageOption
public static ApplicationCommandOption
requiredMessageOption
public final String
pluginName
public final List<String>
pluginCommands
-
Constructor Summary
Constructors Constructor Description CommandsAPI(String plugin)
Create a CommandsAPI for the specified plugin
-
Method Summary
Modifier and Type Method Description static Application
getAliucordApplication()
Returns the Aliucord Application static long
generateId()
Generate a fake Snowflake static String
generateIdString()
Generate a fake Snowflake String void
registerCommand(@NonNull() String name, @NonNull() String description, @NonNull() List<ApplicationCommandOption> options, @NonNull() Function1<CommandContext, CommandsAPI.CommandResult> execute)
Registers a slash command. void
registerCommand(@NonNull() String name, @NonNull() String description, @NonNull() ApplicationCommandOption option, @NonNull() Function1<CommandContext, CommandsAPI.CommandResult> execute)
Registers a slash command. void
registerCommand(@NonNull() String name, @NonNull() String description, @NonNull() Function1<CommandContext, CommandsAPI.CommandResult> execute)
Registers a slash command. void
unregisterCommand(String name)
Unregisters a command. void
unregisterAll()
Unregisters all commands -
-
Constructor Detail
-
CommandsAPI
CommandsAPI(String plugin)
Create a CommandsAPI for the specified plugin
-
-
Method Detail
-
getAliucordApplication
static Application getAliucordApplication()
Returns the Aliucord Application
-
generateId
static long generateId()
Generate a fake Snowflake
-
generateIdString
static String generateIdString()
Generate a fake Snowflake String
-
registerCommand
void registerCommand(@NonNull() String name, @NonNull() String description, @NonNull() List<ApplicationCommandOption> options, @NonNull() Function1<CommandContext, CommandsAPI.CommandResult> execute)
Registers a slash command.
- Parameters:
name
- Name of the command.description
- Description of the command.options
- Arguments for the command.execute
- Callback for the command.
-
registerCommand
void registerCommand(@NonNull() String name, @NonNull() String description, @NonNull() ApplicationCommandOption option, @NonNull() Function1<CommandContext, CommandsAPI.CommandResult> execute)
Registers a slash command.
- Parameters:
name
- Name of the command.description
- Description of the command.option
- Argument for the command.execute
- Callback for the command.
-
registerCommand
void registerCommand(@NonNull() String name, @NonNull() String description, @NonNull() Function1<CommandContext, CommandsAPI.CommandResult> execute)
Registers a slash command.
- Parameters:
name
- Name of the command.description
- Description of the command.execute
- Callback for the command.
-
unregisterCommand
void unregisterCommand(String name)
Unregisters a command.
- Parameters:
name
- Command to unregister.
-
unregisterAll
void unregisterAll()
Unregisters all commands
-
-
-
-