We have multiple bots using slash commands so if this instance can't find a button/modal/selectmenu it shouldn't respond to it

This commit is contained in:
Teriuihi 2023-01-08 03:48:45 +01:00
parent f93ad8b4fb
commit 265ddd82c3
3 changed files with 21 additions and 21 deletions

View File

@ -36,13 +36,13 @@ public class ButtonManager extends ListenerAdapter {
.filter(discordModal -> discordModal.getButtonId().equalsIgnoreCase(buttonId)) .filter(discordModal -> discordModal.getButtonId().equalsIgnoreCase(buttonId))
.findFirst(); .findFirst();
if (first.isEmpty()) { if (first.isEmpty()) {
event.replyEmbeds(new EmbedBuilder() // event.replyEmbeds(new EmbedBuilder()
.setTitle("Invalid command") // .setTitle("Invalid command")
.setDescription("Unable to process button with id: [" + buttonId + "], please report this issue to a Teri") // .setDescription("Unable to process button with id: [" + buttonId + "], please report this issue to a Teri")
.setColor(Color.RED) // .setColor(Color.RED)
.build()) // .build())
.setEphemeral(true) // .setEphemeral(true)
.queue(RestAction.getDefaultSuccess(), Util::handleFailure); // .queue(RestAction.getDefaultSuccess(), Util::handleFailure);
return; return;
} }
first.get().execute(event); first.get().execute(event);

View File

@ -35,13 +35,13 @@ public class ModalManager extends ListenerAdapter {
.filter(discordModal -> discordModal.getModalId().equalsIgnoreCase(modalId)) .filter(discordModal -> discordModal.getModalId().equalsIgnoreCase(modalId))
.findFirst(); .findFirst();
if (first.isEmpty()) { if (first.isEmpty()) {
event.replyEmbeds(new EmbedBuilder() // event.replyEmbeds(new EmbedBuilder()
.setTitle("Invalid command") // .setTitle("Invalid command")
.setDescription("Unable to process modal with id: [" + modalId + "], please report this issue to a Teri") // .setDescription("Unable to process modal with id: [" + modalId + "], please report this issue to a Teri")
.setColor(Color.RED) // .setColor(Color.RED)
.build()) // .build())
.setEphemeral(true) // .setEphemeral(true)
.queue(RestAction.getDefaultSuccess(), Util::handleFailure); // .queue(RestAction.getDefaultSuccess(), Util::handleFailure);
return; return;
} }
first.get().execute(event); first.get().execute(event);

View File

@ -28,13 +28,13 @@ public class SelectMenuManager extends ListenerAdapter {
.filter(discordModal -> discordModal.getSelectMenuId().equalsIgnoreCase(selectMenuId)) .filter(discordModal -> discordModal.getSelectMenuId().equalsIgnoreCase(selectMenuId))
.findFirst(); .findFirst();
if (first.isEmpty()) { if (first.isEmpty()) {
event.replyEmbeds(new EmbedBuilder() // event.replyEmbeds(new EmbedBuilder()
.setTitle("Invalid command") // .setTitle("Invalid command")
.setDescription("Unable to process select menu with id: [" + selectMenuId + "], please report this issue to a Teri") // .setDescription("Unable to process select menu with id: [" + selectMenuId + "], please report this issue to a Teri")
.setColor(Color.RED) // .setColor(Color.RED)
.build()) // .build())
.setEphemeral(true) // .setEphemeral(true)
.queue(RestAction.getDefaultSuccess(), Util::handleFailure); // .queue(RestAction.getDefaultSuccess(), Util::handleFailure);
return; return;
} }
first.get().execute(event); first.get().execute(event);