fix button interactions
This commit is contained in:
parent
c78033f409
commit
0e781f3d9a
@ -20,6 +20,9 @@ import java.util.Optional;
|
||||
public class RequestListener implements EventListener {
|
||||
@Override
|
||||
public void onButtonInteraction(BatGuild guild, @NonNull BatUser user, @NonNull ButtonInteractionEvent event) {
|
||||
if (guild == null) {
|
||||
return;
|
||||
}
|
||||
if (!event.getComponentId().equals("drag-request-cancel")) {
|
||||
return;
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ import org.springframework.stereotype.Component;
|
||||
public class TargetChannelListener implements EventListener {
|
||||
@Override
|
||||
public void onButtonInteraction(BatGuild guild, @NonNull BatUser user, @NonNull ButtonInteractionEvent event) {
|
||||
if (guild == null) {
|
||||
return;
|
||||
}
|
||||
User buttonUser = event.getUser();
|
||||
Member member = guild.getDiscordGuild().getMember(buttonUser);
|
||||
if (member == null) return;
|
||||
|
@ -48,6 +48,9 @@ public class CurrentSubCommand extends BatCommand implements EventListener {
|
||||
|
||||
@Override @SneakyThrows
|
||||
public void onButtonInteraction(BatGuild guild, @NonNull BatUser user, @NonNull ButtonInteractionEvent event) {
|
||||
if (guild == null) {
|
||||
return;
|
||||
}
|
||||
if (!event.getUser().getId().equals(user.getId())) {
|
||||
throw new BatException("%s You cannot interact with this message.".formatted(Emojis.CROSS_MARK_EMOJI));
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ public class LinkSubCommand extends BatCommand implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onButtonInteraction(BatGuild guild, @NonNull BatUser user, @NonNull ButtonInteractionEvent event) {
|
||||
if (guild == null) {
|
||||
return;
|
||||
}
|
||||
if (!event.getComponentId().equals("spotify_link")) {
|
||||
return;
|
||||
}
|
||||
|
@ -106,6 +106,9 @@ public class MovieSubCommand extends BatCommand implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onButtonInteraction(BatGuild guild, @NonNull BatUser user, @NonNull ButtonInteractionEvent event) {
|
||||
if (guild == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, String> params = userCommands.get(user.getId());
|
||||
if (params == null) {
|
||||
return;
|
||||
|
@ -103,6 +103,9 @@ public class SeriesSubCommand extends BatCommand implements EventListener {
|
||||
|
||||
@Override
|
||||
public void onButtonInteraction(BatGuild guild, @NonNull BatUser user, @NonNull ButtonInteractionEvent event) {
|
||||
if (guild == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, String> params = userCommands.get(user.getId());
|
||||
if (params == null) {
|
||||
return;
|
||||
|
@ -141,7 +141,7 @@ public class EventService extends ListenerAdapter {
|
||||
if (event.getUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
BatGuild guild = event.getGuild() != null ? guildService.getGuild(event.getGuild().getId()) : null;
|
||||
BatGuild guild = event.getGuild() == null ? null : guildService.getGuild(event.getGuild().getId());
|
||||
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
|
||||
|
||||
for (EventListener listener : LISTENERS) {
|
||||
@ -154,7 +154,7 @@ public class EventService extends ListenerAdapter {
|
||||
if (event.getUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
BatGuild guild = event.getGuild() != null ? guildService.getGuild(event.getGuild().getId()) : null;
|
||||
BatGuild guild = event.getGuild() == null ? null : guildService.getGuild(event.getGuild().getId());
|
||||
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
|
||||
|
||||
try {
|
||||
@ -172,7 +172,7 @@ public class EventService extends ListenerAdapter {
|
||||
if (event.getUser().isBot()) {
|
||||
return;
|
||||
}
|
||||
BatGuild guild = event.getGuild() != null ? guildService.getGuild(event.getGuild().getId()) : null;
|
||||
BatGuild guild = event.getGuild() == null ? null : guildService.getGuild(event.getGuild().getId());
|
||||
BatUser user = userService.getUser(event.getUser().getId(), event.getUser());
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user