This commit is contained in:
parent
4d891e1825
commit
455c3f0bf1
@ -100,7 +100,8 @@ public class CommandService extends ListenerAdapter {
|
||||
if (command == null) {
|
||||
return;
|
||||
}
|
||||
BatGuild guild = discordGuild != null ? guildService.getGuild(discordGuild.getId()) : null;
|
||||
boolean ranInsideGuild = discordGuild != null;
|
||||
BatGuild guild = ranInsideGuild ? guildService.getGuild(discordGuild.getId()) : null;
|
||||
BatUser user = userService.getUser(event.getUser().getId());
|
||||
|
||||
try {
|
||||
@ -131,7 +132,7 @@ public class CommandService extends ListenerAdapter {
|
||||
}
|
||||
|
||||
// Check if the user has the required permissions
|
||||
if (discordGuild != null && event.getMember() != null) {
|
||||
if (ranInsideGuild && event.getMember() != null) {
|
||||
List<Permission> missingPermissions = new ArrayList<>();
|
||||
for (Permission permission : requiredPermissions) {
|
||||
if (!event.getMember().hasPermission(permission)) {
|
||||
@ -147,7 +148,7 @@ public class CommandService extends ListenerAdapter {
|
||||
return;
|
||||
}
|
||||
}
|
||||
executor.execute(guild, user, guild != null ? event.getChannel().asTextChannel() : event.getChannel().asPrivateChannel(),
|
||||
executor.execute(guild, user, ranInsideGuild ? event.getChannel().asTextChannel() : event.getChannel().asPrivateChannel(),
|
||||
event.getMember(), event.getInteraction());
|
||||
} catch (Exception ex) {
|
||||
log.error("An error occurred while executing command \"{}\"", commandName, ex);
|
||||
|
Loading…
Reference in New Issue
Block a user