| 
21 | 21 | import io.github.org.programming.backend.extension.MessageCommandExtender;  | 
22 | 22 | import net.dv8tion.jda.api.JDA;  | 
23 | 23 | import net.dv8tion.jda.api.entities.Guild;  | 
24 |  | -import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;  | 
25 |  | -import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;  | 
26 | 24 | import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;  | 
27 |  | -import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;  | 
28 |  | -import net.dv8tion.jda.api.events.interaction.component.SelectMenuInteractionEvent;  | 
29 | 25 | import net.dv8tion.jda.api.requests.restaction.CommandListUpdateAction;  | 
30 | 26 | import org.jetbrains.annotations.NotNull;  | 
31 | 27 | import org.slf4j.Logger;  | 
@@ -68,9 +64,8 @@ protected MessageCommandHandler(@NotNull JDA jda, @NotNull Guild guild) {  | 
68 | 64 |      */  | 
69 | 65 |     @SuppressWarnings("ResultOfMethodCallIgnored")  | 
70 | 66 |     private void addMessageCommand(@NotNull MessageCommandExtender command) {  | 
71 |  | - | 
72 | 67 |         BaseHandler.checkIfBuildIsNull(command.build(), command.getClass().getSimpleName());  | 
73 |  | - | 
 | 68 | +        jda.addEventListener(command);  | 
74 | 69 |         messageCommand.put(command.build().getCommandData().getName(), command);  | 
75 | 70 |         if (command.build().isGuildOnly()) {  | 
76 | 71 |             guildCommandsData.addCommands(command.build().getCommandData());  | 
@@ -136,35 +131,10 @@ public void onMessageContextInteraction(@Nonnull MessageContextInteractionEvent  | 
136 | 131 |                 && !event.getGuild().getSelfMember().hasPermission(cmd.build().getBotPerms())) {  | 
137 | 132 |             event.reply("I do not have permission to use this command.").setEphemeral(true).queue();  | 
138 | 133 |         } else {  | 
139 |  | -            cmd.onMessageContextInteraction(event);  | 
 | 134 | +            cmd.onMessageContext(event);  | 
140 | 135 |         }  | 
141 | 136 |     }  | 
142 | 137 | 
 
  | 
143 |  | -    @Override  | 
144 |  | -    public void onButtonInteraction(@Nonnull ButtonInteractionEvent event) {  | 
145 |  | -        final MessageCommandExtender cmd = messageCommand.get(event.getComponentId());  | 
146 |  | -        cmd.onButtonClick(event);  | 
147 |  | -    }  | 
148 |  | - | 
149 |  | -    @Override  | 
150 |  | -    public void onSelectMenuInteraction(@Nonnull SelectMenuInteractionEvent event) {  | 
151 |  | -        final MessageCommandExtender cmd = messageCommand.get(event.getComponentId());  | 
152 |  | -        cmd.onSelectMenu(event);  | 
153 |  | -    }  | 
154 |  | - | 
155 |  | -    @Override  | 
156 |  | -    public void onCommandAutoCompleteInteraction(  | 
157 |  | -            @Nonnull CommandAutoCompleteInteractionEvent event) {  | 
158 |  | -        final MessageCommandExtender cmd = messageCommand.get(event.getName());  | 
159 |  | -        cmd.onCommandAutoComplete(event);  | 
160 |  | -    }  | 
161 |  | - | 
162 |  | -    @Override  | 
163 |  | -    public void onModalInteraction(@Nonnull ModalInteractionEvent event) {  | 
164 |  | -        final MessageCommandExtender cmd = messageCommand.get(event.getModalId());  | 
165 |  | -        cmd.onModalInteraction(event);  | 
166 |  | -    }  | 
167 |  | - | 
168 | 138 |     /**  | 
169 | 139 |      * Gets slash commands as a list.  | 
170 | 140 |      *  | 
 | 
0 commit comments