Skip to content

Commit

Permalink
Fabricord ver2.1-1.20.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Lqrs committed Nov 29, 2023
1 parent 19cab4f commit 92b2b02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/main/java/net/elysium/mod/fabricord/discord/DiscordBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down
Binary file modified src/main/resources/assets/fabricord/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 92b2b02

Please sign in to comment.