From 895f2abf7e41eb013eb3da402c6852cb53d5f0c8 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Wed, 26 Apr 2023 15:23:43 +0700 Subject: [PATCH] chat queue delay in config --- .idea/workspace.xml | 25 +++++++++++-------- .../chayapak/chomens_bot/Configuration.java | 2 ++ .../chomens_bot/plugins/ChatPlugin.java | 2 +- src/main/resources/default-config.yml | 2 ++ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9b16f2e..d6834c0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,8 +4,11 @@ - @@ -480,7 +482,8 @@ - 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 6580629..5566f23 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java @@ -16,6 +16,8 @@ public class Configuration { @Getter public int reconnectDelay = 2000; + @Getter public int chatQueueDelay = 125; + @Getter public Map keys; @Getter public String weatherApiKey; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java index 435d486..e5b7b5b 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java @@ -49,7 +49,7 @@ public class ChatPlugin extends Bot.Listener { chatParsers.add(new KaboomChatParser(bot)); chatParsers.add(new ChomeNSCustomChatParser(bot)); - bot.executor().scheduleAtFixedRate(this::sendChatTick, 0, 125, TimeUnit.MILLISECONDS); + bot.executor().scheduleAtFixedRate(this::sendChatTick, 0, bot.config().chatQueueDelay(), TimeUnit.MILLISECONDS); } @Override diff --git a/src/main/resources/default-config.yml b/src/main/resources/default-config.yml index 90646c0..e236401 100644 --- a/src/main/resources/default-config.yml +++ b/src/main/resources/default-config.yml @@ -11,6 +11,8 @@ consolePrefixes: reconnectDelay: 2000 +chatQueueDelay: 125 + discord: prefix: 'default!' token: 'token here'