Package de.presti.ree6.commands
Class CommandManager
java.lang.Object
de.presti.ree6.commands.CommandManager
Manager class used to manage all Commands and command related operation.
-
Constructor Summary
ConstructorDescriptionConstructor for the Command-Manager used to register every Command. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommand
(ICommand command) Add a single Command to the Command list.void
addSlashCommand
(net.dv8tion.jda.api.JDA jda) Method used to add all Commands as SlashCommand on Discord.void
deleteMessage
(net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Delete a specific message.getCommandByName
(String name) Get a Command by its name.getCommandBySlashName
(String name) Get a Command by its slash command name.boolean
isTimeout
(net.dv8tion.jda.api.entities.User user) Check if a User is time-outed.boolean
perform
(net.dv8tion.jda.api.entities.Member member, net.dv8tion.jda.api.entities.Guild guild, String messageContent, net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent slashCommandInteractionEvent) Try to perform a Command.void
removeCommand
(ICommand command) Remove a Command from the List.void
sendMessage
(String message, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel, with a deletion delay.void
sendMessage
(String messageContent, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel, with a deletion delay.void
sendMessage
(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel.void
sendMessage
(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel.void
sendMessage
(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send an Embed to a special Message-Channel, with a deletion delay.void
sendMessage
(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send an Embed to a special Message-Channel, with a deletion delay.void
sendMessage
(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send an Embed to a special Message-Channel.void
sendMessage
(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send an Embed to a special Message-Channel.void
sendMessage
(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, CommandEvent commandEvent) Send a message to a special Message-Channel.void
sendMessage
(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel, with a deletion delay.void
sendMessage
(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel, with a deletion delay.void
sendMessage
(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, CommandEvent commandEvent) Send a message to a special Message-Channel.void
sendMessage
(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel.void
sendMessage
(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel.
-
Constructor Details
-
CommandManager
public CommandManager() throws CommandInitializerException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetExceptionConstructor for the Command-Manager used to register every Command.- Throws:
CommandInitializerException
- if an error occurs while initializing the Commands.IllegalStateException
- if an Invalid Command was used to initialize.IllegalAccessException
- when an Instance of a Command is not accessible.InstantiationException
- when an Instance of a Command is not instantiable.NoSuchMethodException
- when a Constructor Instance of a Command is not found.InvocationTargetException
- when a Constructor Instance of a Command is not found.
-
-
Method Details
-
addSlashCommand
public void addSlashCommand(net.dv8tion.jda.api.JDA jda) Method used to add all Commands as SlashCommand on Discord.- Parameters:
jda
- Instance of the Bot.
-
addCommand
Add a single Command to the Command list.- Parameters:
command
- theICommand
.- Throws:
CommandInitializerException
- if an error occurs while initializing the Command.
-
getCommandByName
Get a Command by its name.- Parameters:
name
- the Name of the Command.- Returns:
- the
ICommand
with the same Name.
-
getCommandBySlashName
Get a Command by its slash command name.- Parameters:
name
- the Name of the Command.- Returns:
- the
ICommand
with the same Name.
-
removeCommand
Remove a Command from the List.- Parameters:
command
- the Command you want to remove.
-
perform
public boolean perform(net.dv8tion.jda.api.entities.Member member, net.dv8tion.jda.api.entities.Guild guild, String messageContent, net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent slashCommandInteractionEvent) Try to perform a Command.- Parameters:
member
- the Member that performed the try.guild
- the Guild the Member is from.messageContent
- the Message content (including the prefix + command name).message
- the Message Entity.textChannel
- the TextChannel where the command has been performed.slashCommandInteractionEvent
- the Slash Command Event if it was a Slash Command.- Returns:
- true, if a command has been performed.
-
isTimeout
public boolean isTimeout(net.dv8tion.jda.api.entities.User user) Check if a User is time-outed.- Parameters:
user
- the User.- Returns:
- true, if yes | false, if not.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, CommandEvent commandEvent) Send a message to a special Message-Channel.- Parameters:
messageCreateData
- the Message content.commandEvent
- the Command-Event.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, CommandEvent commandEvent) Send a message to a special Message-Channel.- Parameters:
messageCreateData
- the Message content.deleteSecond
- the delete delaycommandEvent
- the Command-Event.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel.- Parameters:
messageCreateData
- the Message content.messageChannel
- the Message-Channel.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel, with a deletion delay.- Parameters:
messageCreateData
- the Message content.deleteSecond
- the delete delaymessageChannel
- the Message-Channel.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel.- Parameters:
messageCreateData
- the Message content.messageChannel
- the Message-Channel.interactionHook
- the Interaction-hook if it is a slash command.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel, with a deletion delay.- Parameters:
messageCreateData
- the Message content.messageChannel
- the Message-Channel.interactionHook
- the Interaction-hook if it is a slash command.deleteSecond
- the delete delay
-
sendMessage
public void sendMessage(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel.- Parameters:
message
- the Message content.messageChannel
- the Message-Channel.
-
sendMessage
public void sendMessage(String message, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send a message to a special Message-Channel, with a deletion delay.- Parameters:
message
- the Message content.deleteSecond
- the delete delaymessageChannel
- the Message-Channel.
-
sendMessage
public void sendMessage(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel.- Parameters:
message
- the Message content.messageChannel
- the Message-Channel.interactionHook
- the Interaction-hook if it is a slash command.
-
sendMessage
public void sendMessage(String messageContent, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send a message to a special Message-Channel, with a deletion delay.- Parameters:
messageContent
- the Message content.messageChannel
- the Message-Channel.interactionHook
- the Interaction-hook if it is a slash command.deleteSecond
- the delete delay
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send an Embed to a special Message-Channel.- Parameters:
embedBuilder
- the Embed content.messageChannel
- the Message-Channel.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel) Send an Embed to a special Message-Channel, with a deletion delay.- Parameters:
embedBuilder
- the Embed content.deleteSecond
- the delete delaymessageChannel
- the Message-Channel.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send an Embed to a special Message-Channel.- Parameters:
embedBuilder
- the Embed content.messageChannel
- the Message-Channel.interactionHook
- the Interaction-hook if it is a slash command.
-
sendMessage
public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Send an Embed to a special Message-Channel, with a deletion delay.- Parameters:
embedBuilder
- the Embed content.deleteSecond
- the delete delaymessageChannel
- the Message-Channel.interactionHook
- the Interaction-hook if it is a slash command.
-
deleteMessage
public void deleteMessage(net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.interactions.InteractionHook interactionHook) Delete a specific message.- Parameters:
message
- theMessage
entity.interactionHook
- the Interaction-hook, if it is a slash event.
-