fix some logging things
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m5s

This commit is contained in:
Lee 2024-07-05 21:47:29 +01:00
parent 863206bb9f
commit a605ab2dba

View File

@ -80,14 +80,17 @@ public class MemberListener implements EventListener {
if (user.getDiscordUser().isBot()) {
return;
}
log.info("User \"{}\" changed their nickname from \"{}\" to \"{}\" in the guild \"{}\"", user.getName(), oldName, newName, guild.getDiscordGuild().getName());
String oldNameFormatted = oldName == null ? user.getName() : oldName;
String newNameFormatted = newName == null ? user.getName() : newName;
log.info("User \"{}\" changed their nickname from \"{}\" to \"{}\" in the guild \"{}\"",
user.getName(), oldNameFormatted, newNameFormatted, guild.getDiscordGuild().getName());
logFeature.sendLog(guild, LogType.MEMBER_NICKNAME_UPDATE, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Nickname Updated")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Nickname: `%s` -> `%s`".formatted(
oldName == null ? user.getName() : oldName,
newName == null ? user.getName() : newName
oldNameFormatted,
newNameFormatted
), true)
.build())
.build());
@ -98,7 +101,9 @@ public class MemberListener implements EventListener {
if (user.getDiscordUser().isBot()) {
return;
}
log.info("User \"{}\" changed their global name from \"{}\" to \"{}\"", user.getName(), oldName, newName);
String oldNameFormatted = oldName == null ? user.getName() : oldName;
String newNameFormatted = newName == null ? user.getName() : newName;
log.info("User \"{}\" changed their global name from \"{}\" to \"{}\"", user.getName(), oldNameFormatted, newNameFormatted);
for (Guild guild : DiscordService.JDA.getGuilds()) {
BatGuild batGuild = guildService.getGuild(guild.getId());
@ -109,8 +114,8 @@ public class MemberListener implements EventListener {
.setDescription(new EmbedDescriptionBuilder("Member Name Updated")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Name: `%s` -> `%s`".formatted(
oldName == null ? user.getName() : oldName,
newName == null ? user.getName() : newName
oldNameFormatted,
newNameFormatted
), true)
.build())
.build());
@ -153,7 +158,7 @@ public class MemberListener implements EventListener {
logFeature.sendLog(batGuild, LogType.MEMBER_USERNAME_UPDATE, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Avatar Updated")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Avatar: %s".formatted(newAvatarUrl == null ? "Removed" : "[avatar](%s)".formatted(newAvatarUrl)), true)
.appendLine("Avatar: %s".formatted(newAvatarUrl == null ? "Removed" : "[click here](%s)".formatted(newAvatarUrl)), true)
.build())
.setThumbnail(newAvatarUrl)
.build());