diff --git a/src/main/java/org/geysermc/discordbot/commands/moderation/BanCommand.java b/src/main/java/org/geysermc/discordbot/commands/moderation/BanCommand.java index c2017f8e..61d18b15 100644 --- a/src/main/java/org/geysermc/discordbot/commands/moderation/BanCommand.java +++ b/src/main/java/org/geysermc/discordbot/commands/moderation/BanCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022 GeyserMC. http://geysermc.org + * Copyright (c) 2020-2024 GeyserMC. http://geysermc.org * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -174,13 +174,22 @@ private MessageEmbed handle(Member member, Member moderator, Guild guild, int da embedBuilder.addField("Additional Info", punishmentMessage, false); } - channel.sendMessageEmbeds(embedBuilder.build()).queue(message -> {}, throwable -> {}); - }, throwable -> {}); + channel.sendMessageEmbeds(embedBuilder.build()).queue(message -> { + // Ban user + guild.ban(user, days, TimeUnit.DAYS).reason(reason).queue(); + }, throwable -> { + // Ban user + guild.ban(user, days, TimeUnit.DAYS).reason(reason).queue(); + }); + }, throwable -> { + // Ban user + guild.ban(user, days, TimeUnit.DAYS).reason(reason).queue(); + }); + } else { + // Ban user + guild.ban(user, days, TimeUnit.DAYS).reason(reason).queue(); } - // Ban user - guild.ban(user, days, TimeUnit.DAYS).reason(reason).queue(); - // Log the change int id = GeyserBot.storageManager.addLog(moderator, "ban", user, reason); diff --git a/src/main/java/org/geysermc/discordbot/commands/moderation/KickCommand.java b/src/main/java/org/geysermc/discordbot/commands/moderation/KickCommand.java index f24ba41c..0d144daa 100644 --- a/src/main/java/org/geysermc/discordbot/commands/moderation/KickCommand.java +++ b/src/main/java/org/geysermc/discordbot/commands/moderation/KickCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022 GeyserMC. http://geysermc.org + * Copyright (c) 2020-2024 GeyserMC. http://geysermc.org * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -163,17 +163,26 @@ private MessageEmbed handle(Member member, Member moderator, Guild guild, boolea .setColor(BotColors.FAILURE.getColor()); String punishmentMessage = GeyserBot.storageManager.getServerPreference(guild.getIdLong(), "punishment-message"); - if (!punishmentMessage.isEmpty()) { + if (punishmentMessage != null && !punishmentMessage.isEmpty()) { embedBuilder.addField("Additional Info", punishmentMessage, false); } - channel.sendMessageEmbeds(embedBuilder.build()).queue(message -> {}, throwable -> {}); - }, throwable -> {}); + channel.sendMessageEmbeds(embedBuilder.build()).queue(message -> { + // Kick user + guild.kick(user).reason(reason).queue(); + }, throwable -> { + // Kick user + guild.kick(user).reason(reason).queue(); + }); + }, throwable -> { + // Kick user + guild.kick(user).reason(reason).queue(); + }); + } else { + // Kick user + guild.kick(user).reason(reason).queue(); } - // Kick user - guild.kick(user).reason(reason).queue(); - // Log the change int id = GeyserBot.storageManager.addLog(moderator, "kick", user, reason);