merge role add/remove into 1 update type and rename nickname logtype

This commit is contained in:
Lee 2024-07-02 19:09:01 +01:00
parent deb93e442c
commit 86c147f359
2 changed files with 5 additions and 6 deletions

View File

@ -22,9 +22,8 @@ public enum LogType {
*/
MEMBER_JOIN(LogCategory.MEMBER, "Member Join"),
MEMBER_LEAVE(LogCategory.MEMBER, "Member Leave"),
MEMBER_NICKNAME_CHANGE(LogCategory.MEMBER, "Member Nickname Change"),
MEMBER_ROLE_ADD(LogCategory.MEMBER, "Member Role Add"),
MEMBER_ROLE_REMOVE(LogCategory.MEMBER, "Member Role Remove");
MEMBER_NICKNAME_UPDATE(LogCategory.MEMBER, "Member Nickname Update"),
MEMBER_ROLE_UPDATE(LogCategory.MEMBER, "Member Role Update");
/**
* The category of the log type

View File

@ -62,7 +62,7 @@ public class MemberListener implements EventListener {
public void onGuildMemberUpdateNickname(@NonNull BatGuild guild, @NonNull BatUser user, String oldName, String newName, @NonNull GuildMemberUpdateNicknameEvent event) {
if (user.getDiscordUser().isBot()) return;
logFeature.sendLog(guild, LogType.MEMBER_NICKNAME_CHANGE, EmbedUtils.genericEmbed()
logFeature.sendLog(guild, LogType.MEMBER_NICKNAME_UPDATE, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Nickname Changed")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Old Nickname: `%s`".formatted(oldName == null ? user.getName() : oldName), true)
@ -81,7 +81,7 @@ public class MemberListener implements EventListener {
}
String s = rolesAdded.size() > 1 ? "s" : "";
logFeature.sendLog(guild, LogType.MEMBER_ROLE_ADD, EmbedUtils.successEmbed()
logFeature.sendLog(guild, LogType.MEMBER_ROLE_UPDATE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Role%s Added".formatted(s))
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Role%s Added: %s".formatted(s, roles.substring(0, roles.length() - 2)), true)
@ -99,7 +99,7 @@ public class MemberListener implements EventListener {
}
String s = rolesAdded.size() > 1 ? "s" : "";
logFeature.sendLog(guild, LogType.MEMBER_ROLE_REMOVE, EmbedUtils.errorEmbed()
logFeature.sendLog(guild, LogType.MEMBER_ROLE_UPDATE, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Role%s Removed".formatted(s))
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Role%s Removed: %s".formatted(s, roles.substring(0, roles.length() - 2)), true)