From 0d99f2b724618cf0ee90080fc08bfb7c0c99726a Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 2 May 2023 14:31:23 +0700 Subject: [PATCH] discord improvements? --- .../chayapak/chomens_bot/Configuration.java | 1 + .../chomens_bot/commands/DiscordCommand.java | 5 ++++- .../chomens_bot/plugins/DiscordPlugin.java | 16 +++++++++------- src/main/resources/default-config.yml | 1 + 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java index 206973a..dd0ee1d 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java @@ -45,6 +45,7 @@ public class Configuration { @Getter public String trustedRoleName = "Trusted"; @Getter public String adminRoleName = "Admin"; @Getter public String statusMessage = "Gay Sex"; + @Getter public String inviteLink = "https://discord.gg/xdgCkUyaA4"; } public static class EmbedColors { diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/DiscordCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/DiscordCommand.java index c3733d8..dc5dc09 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/DiscordCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/DiscordCommand.java @@ -1,5 +1,6 @@ package land.chipmunk.chayapak.chomens_bot.commands; +import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.command.Command; import land.chipmunk.chayapak.chomens_bot.command.CommandContext; import net.kyori.adventure.text.Component; @@ -35,7 +36,9 @@ public class DiscordCommand implements Command { } public Component execute(CommandContext context, String[] args, String[] fullArgs) { - final String link = "https://discord.gg/xdgCkUyaA4"; + final Bot bot = context.bot(); + + final String link = bot.config().discord().inviteLink(); return Component.empty() .append(Component.text("The Discord invite is ").color(NamedTextColor.WHITE)) .append( 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 0e09226..781ab63 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 @@ -143,7 +143,7 @@ public class DiscordPlugin { ) .color(NamedTextColor.RED); - final String discordUrl = "https://discord.gg/xdgCkUyaA4"; // too lazy to make a config + final String discordUrl = config.discord().inviteLink(); // too lazy to make a config final Component discordComponent = Component.empty() .append(Component.text("ChomeNS ").color(NamedTextColor.YELLOW)) @@ -156,14 +156,16 @@ public class DiscordPlugin { .clickEvent(ClickEvent.openUrl(discordUrl)); final Component component = Component.translatable( - "[%s] %s › %s%s", + "[%s] %s › %s", discordComponent, nameComponent, - Component.text( - message - .replace("\uD83D\uDC80", "☠") // mirko forced me to do it :( - ).color(NamedTextColor.GRAY), - attachmentsComponent + Component + .text( + message + .replace("\uD83D\uDC80", "☠") + ) + .color(NamedTextColor.GRAY) + .append(attachmentsComponent) ).color(NamedTextColor.DARK_GRAY); bot.chat().tellraw(component); } diff --git a/src/main/resources/default-config.yml b/src/main/resources/default-config.yml index 1ad763c..c62bbec 100644 --- a/src/main/resources/default-config.yml +++ b/src/main/resources/default-config.yml @@ -19,6 +19,7 @@ discord: trustedRoleName: 'Trusted' adminRoleName: 'Admin' # NOTE: admin will be able to access servereval.. statusMessage: 'Gay Sex' + inviteLink: 'https://discord.gg/xdgCkUyaA4' servers: localhost:25565: 'channel id'