diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java index 792a44e..3f19734 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java @@ -40,11 +40,25 @@ public class DiscordPlugin { public final String prefix; + public Component messagePrefix; + + public final String discordUrl; + public DiscordPlugin (Configuration config, JDA jda) { final Configuration.Discord options = config.discord; this.prefix = options.prefix; this.servers = options.servers; this.jda = jda; + this.discordUrl = config.discord.inviteLink; + this.messagePrefix = Component.empty() + .append(Component.text("ChomeNS ").color(NamedTextColor.YELLOW)) + .append(Component.text("Discord").color(NamedTextColor.BLUE)) + .hoverEvent( + HoverEvent.showText( + Component.text("Click here to join the Discord server").color(NamedTextColor.GREEN) + ) + ) + .clickEvent(ClickEvent.openUrl(discordUrl)); if (jda == null) return; @@ -262,18 +276,6 @@ public class DiscordPlugin { if (nameComponent.color() == null) nameComponent = nameComponent.color(NamedTextColor.RED); - final String discordUrl = config.discord.inviteLink; - - final Component discordComponent = Component.empty() - .append(Component.text("ChomeNS ").color(NamedTextColor.YELLOW)) - .append(Component.text("Discord").color(NamedTextColor.BLUE)) - .hoverEvent( - HoverEvent.showText( - Component.text("Click here to join the Discord server").color(NamedTextColor.GREEN) - ) - ) - .clickEvent(ClickEvent.openUrl(discordUrl)); - final Component deserialized = LegacyComponentSerializer.legacyAmpersand().deserialize(message.replace("\uD83D\uDC80", "☠")); final Component messageComponent = Component @@ -287,7 +289,7 @@ public class DiscordPlugin { final Component component = Component.translatable( "[%s] %s › %s", - discordComponent, + messagePrefix, nameComponent, messageComponent ).color(NamedTextColor.DARK_GRAY); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FormatCheckerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FormatCheckerPlugin.java index 307475d..d00d573 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FormatCheckerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FormatCheckerPlugin.java @@ -43,7 +43,7 @@ public class FormatCheckerPlugin extends ChatPlugin.Listener { final Component prefix = format.args().get(0); - if (prefix.equals(bot.console.formatPrefix)) return false; + if (prefix.equals(bot.console.formatPrefix) || prefix.equals(bot.discord.messagePrefix)) return false; if (!(prefix instanceof TranslatableComponent translatablePrefix)) return true;