diff --git a/src/main/java/net/elysium/mod/fabricord/discord/DiscordBot.java b/src/main/java/net/elysium/mod/fabricord/discord/DiscordBot.java index 91b314f..ba9cd8f 100644 --- a/src/main/java/net/elysium/mod/fabricord/discord/DiscordBot.java +++ b/src/main/java/net/elysium/mod/fabricord/discord/DiscordBot.java @@ -97,20 +97,28 @@ public void handleDiscordMessage(MessageReceivedEvent event) { var memberId = member != null ? member.getUser().getId() : "00000000000000000000"; var idSuggest = "<@" + memberId + ">"; var highestRole = member != null ? member.getRoles().stream().max(Comparator.comparingInt(Role::getPosition)).orElse(null) : null; - var roleName = highestRole != null ? highestRole.getName() : "Unknown"; + var roleName = highestRole != null ? highestRole.getName() : null; var roleId = highestRole != null ? highestRole.getId() : null; - var rIdSuggest = "<@&" + roleId + ">"; + var rIdSuggest = roleId != null ? "<@&" + roleId + ">" : null; var roleColor = highestRole != null && highestRole.getColor() != null ? highestRole.getColor() : Color.WHITE; var kyoriRoleColor = TextColor.color(roleColor.getRed(), roleColor.getGreen(), roleColor.getBlue()); + var componentMessage = Component.text("[", TextColor.color(0xFFFFFF)) - .append(Component.text("Discord", TextColor.color(0x55CDFC))) - .append(Component.text(" | ", TextColor.color(0xFFFFFF))) - .append(Component.text(roleName, kyoriRoleColor) - .clickEvent(ClickEvent.suggestCommand(rIdSuggest))) - .append(Component.text("]", TextColor.color(0xFFFFFF))) - .append(Component.text(" ")) - .append(Component.text(memberName) + .append(Component.text("Discord", TextColor.color(0x55CDFC))); + + if (roleName != null) { + componentMessage = componentMessage.append(Component.text(" | ", TextColor.color(0xFFFFFF))) + .append(Component.text(roleName, kyoriRoleColor) + .clickEvent(ClickEvent.suggestCommand(rIdSuggest))) + .append(Component.text("]", TextColor.color(0xFFFFFF))) + .append(Component.text(" ")); + } else { + componentMessage = componentMessage.append(Component.text("]", TextColor.color(0xFFFFFF))) + .append(Component.text(" ")); + } + + componentMessage = componentMessage.append(Component.text(memberName) .clickEvent(ClickEvent.suggestCommand(idSuggest))) .append(Component.text(" ยป " + event.getMessage().getContentDisplay())); diff --git a/src/main/resources/assets/fabricord/icon.png b/src/main/resources/assets/fabricord/icon.png index 8a2fb32..9983bad 100644 Binary files a/src/main/resources/assets/fabricord/icon.png and b/src/main/resources/assets/fabricord/icon.png differ