public interface ICommandEngine
| Modifier and Type | Method and Description |
|---|---|
ICommandEngine |
addAlias(String name,
ICommand command)
Add an alternative name to a command.
|
ICommandEngine |
addCommand(ICommand command)
Registers an ICommand into the engine.
|
ICommand |
getCommand(String name)
Get an ICommand from the registered commands in the Engine.
|
List<ICommand> |
getCommands()
Get a list of
ICommand registered in the Engine. |
List<ICommand> |
getCommandsByExactMatch(String name)
Get a list of ICommand from the registered commands in the Engine.
|
List<ICommand> |
getCommandsByPartialMatch(String name)
Get a list of ICommand from the registered commands in the Engine.
|
ICommand |
getHelpCommand()
Return the ICommand object of the help command.
|
Locale |
getLanguage()
Gets the default language to be used by the bot.
|
Locale |
getLanguage(net.dv8tion.jda.api.events.Event event)
By default, gets the default language to be used by the bot.
|
String |
getPrefix()
Gets the prefix configured on the bot.
|
String |
getPrefix(net.dv8tion.jda.api.events.Event event)
By default, it gets the prefix configured on the bot.
|
String |
getPrefix(net.dv8tion.jda.api.events.message.MessageReceivedEvent event)
By default, it gets the prefix configured on the bot.
|
String |
getPrefix(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event)
By default, it gets the prefix configured on the bot.
|
IRepository |
getRepository()
Return the repository Controller.
|
String |
getString(String key)
Gets a text string in the configured language of the bot.
|
String |
getString(String key,
Locale locale)
Gets a text string in a specific language.
|
String[] |
getStringArray(String key)
Gets a string Array in the configured language of the bot.
|
String[] |
getStringArray(String key,
Locale locale)
Gets a string Array in a specific language.
|
boolean |
isReactToMention()
Get whether the bot should react to mention or not.
|
boolean |
isReactToMention(net.dv8tion.jda.api.events.Event event)
Checks if bot should react to mention calls (Messages that starts with @BOT_NAME).
|
void |
loadCommands()
Registers ICommands from packages set into the engine.
|
void |
logDebug(String message)
Log a message at the DEBUG level.
|
void |
logError(String message)
Log a message at the ERROR level.
|
void |
logInfo(String message)
Log a message at the INFO level.
|
void |
logWarn(String message)
Log a message at the WARN level.
|
ICommandEngine |
setHelp(String help)
Set which command is related to user help.
|
ICommandEngine |
setLanguage(Locale language)
Sets the default language to be used by the bot.
|
ICommandEngine |
setPrefix(net.dv8tion.jda.api.entities.Guild guild,
String prefix)
Sets a prefix for a specific guild.
|
ICommandEngine |
setPrefix(String prefix)
Sets the default prefix for the bot.
|
ICommandEngine |
setReactToMention(boolean reactToMention)
Sets if the bot should react to a message starting by mentioning the bot @bot_name
if sets to false, the bot will only react to prefix.
|
void logWarn(String message)
message - the message string to be loggedvoid logDebug(String message)
message - the message string to be loggedvoid logInfo(String message)
message - the message string to be loggedvoid logError(String message)
message - the message string to be loggedICommandEngine setHelp(String help)
help - command nameHelpCommandICommand getHelpCommand()
boolean isReactToMention()
ICommandEngine setReactToMention(boolean reactToMention)
reactToMention - True if the bot should react to mention calls.getPrefix(MessageReceivedEvent)void loadCommands()
boolean isReactToMention(net.dv8tion.jda.api.events.Event event)
event - Discord event that triggered this function call.ICommand getCommand(String name)
List<ICommand> getCommandsByPartialMatch(String name)
name - partial command's name.List<ICommand> getCommandsByExactMatch(String name)
name - expected command's name.List<ICommand> getCommands()
ICommand registered in the Engine.ICommandEngine addCommand(ICommand command) throws DuplicatedNameException, InvalidNameException
command - The command to be registered.DuplicatedNameException - Error if there's another command with the same name or alias registered.InvalidNameException - Error if the command doesn't match the expected name.ICommandEngine addAlias(String name, ICommand command) throws DuplicatedNameException, InvalidNameException
name - alternative name.command - Command to be called.DuplicatedNameException - Thrown when there's already a commando with the same name/alias.InvalidNameException - Thrown when the command's alias uses non-alphanumeric characters.String getPrefix(net.dv8tion.jda.api.events.message.MessageReceivedEvent event)
event - Message Received event that triggered this request.String getPrefix(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event)
event - Slash command that triggered this request.String getPrefix(net.dv8tion.jda.api.events.Event event)
event - Event that triggered this request.String getPrefix()
ICommandEngine setPrefix(String prefix)
prefix - prefix string.ICommandEngine setPrefix(net.dv8tion.jda.api.entities.Guild guild, String prefix)
guild - Guild object.prefix - prefix String.Locale getLanguage()
MultiLocaleResourceBundle.getSupportedLocale()ICommandEngine setLanguage(Locale language)
language - Locale to use.MultiLocaleResourceBundle.getSupportedLocale()Locale getLanguage(net.dv8tion.jda.api.events.Event event)
event - Discord event that triggered this function call.MultiLocaleResourceBundle.getSupportedLocale()String getString(String key)
key - String key in resourceBundle.String getString(String key, Locale locale)
key - String key in resourceBundle.locale - expected language.String[] getStringArray(String key)
key - String key in resourceBundle.String[] getStringArray(String key, Locale locale)
key - String key in resourceBundle.locale - Expected language.IRepository getRepository()