Package org.prithvidiamond1
Class CommandHandler
java.lang.Object
org.prithvidiamond1.CommandHandler
- All Implemented Interfaces:
org.javacord.api.listener.channel.group.GroupChannelAttachableListener,org.javacord.api.listener.channel.server.text.ServerTextChannelAttachableListener,org.javacord.api.listener.channel.TextChannelAttachableListener,org.javacord.api.listener.channel.user.PrivateChannelAttachableListener,org.javacord.api.listener.GloballyAttachableListener,org.javacord.api.listener.interaction.SlashCommandCreateListener,org.javacord.api.listener.message.MessageCreateListener,org.javacord.api.listener.ObjectAttachableListener,org.javacord.api.listener.server.ServerAttachableListener,org.javacord.api.listener.user.UserAttachableListener,org.javacord.api.listener.webhook.WebhookAttachableListener
@Component
public class CommandHandler
extends Object
implements org.javacord.api.listener.message.MessageCreateListener, org.javacord.api.listener.interaction.SlashCommandCreateListener
Class that contains methods and fields for handling command calls
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateHelpDescription(String commandPrefix) Method that generates a help command description based on the descriptions given to each commandvoidonMessageCreate(org.javacord.api.event.message.MessageCreateEvent event) Method that runs a command as a guild command upon receiving its callvoidonSlashCommandCreate(org.javacord.api.event.interaction.SlashCommandCreateEvent event) Method that runs a command as a slash command upon receiving its callorg.javacord.api.interaction.SlashCommandBuilderregisterCommand(String name, String description, Command command) Method to register a command
-
Constructor Details
-
CommandHandler
public CommandHandler()
-
-
Method Details
-
registerCommand
public org.javacord.api.interaction.SlashCommandBuilder registerCommand(String name, String description, Command command) Method to register a command- Parameters:
name- the name of the commanddescription- the description of the commandcommand- the command's instance- Returns:
- a
SlashCommandBuilderwhich can customized using theorg.prithvidiamond1.SlashCommandCustomizers
-
onSlashCommandCreate
public void onSlashCommandCreate(org.javacord.api.event.interaction.SlashCommandCreateEvent event) Method that runs a command as a slash command upon receiving its call- Specified by:
onSlashCommandCreatein interfaceorg.javacord.api.listener.interaction.SlashCommandCreateListener- Parameters:
event- the slash command trigger event
-
onMessageCreate
public void onMessageCreate(org.javacord.api.event.message.MessageCreateEvent event) Method that runs a command as a guild command upon receiving its call- Specified by:
onMessageCreatein interfaceorg.javacord.api.listener.message.MessageCreateListener- Parameters:
event- the guild command trigger event
-
generateHelpDescription
Method that generates a help command description based on the descriptions given to each command- Parameters:
commandPrefix- the guild prefix for the commands- Returns:
- a string that can be used as a help command embed description
-