From e3c026d16abfdb55008d29ffceea051fc53a035c Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Wed, 9 Feb 2022 12:36:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=AF=E5=B0=86=20`/o`?= =?UTF-8?q?=20=E5=91=BD=E4=BB=A4=E5=86=99=E4=B8=BA=20`/on`=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../java/cc/sukazyo/cono/morny/GradleProjectConfigures.java | 4 ++-- .../java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6df2753..1f62c17 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.5.0.6 +VERSION = 0.5.1.0 # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index f48072a..c052959 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny; * the final field that will be updated by gradle automatically. */ public class GradleProjectConfigures { - public static final String VERSION = "0.5.0.6"; - public static final long COMPILE_TIMESTAMP = 1644378359640L; + public static final String VERSION = "0.5.1.0"; + public static final long COMPILE_TIMESTAMP = 1644381263800L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java index d2fc28b..d8979eb 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java @@ -143,7 +143,7 @@ public class MornyCommands { /// private static class ON implements ITelegramCommand { - @Nonnull @Override public String getName () { return "/on"; } + @Nonnull @Override public String getName () { return "/o"; } @Nullable @Override public String[] getAliases () { return null; } @Nonnull @Override public String getParamRule () { return ""; } From 60bf104e9461a53d4feb518d7dc861bebf2e339f Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Wed, 9 Feb 2022 12:40:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=BF=20Morny=20=E5=9C=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=91=BD=E4=BB=A4=E8=A1=A8=E6=97=B6=E4=BC=9A=E5=85=88?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=B8=80=E9=81=8D=E5=91=BD=E4=BB=A4=E8=A1=A8?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../cc/sukazyo/cono/morny/GradleProjectConfigures.java | 4 ++-- src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java | 3 +-- .../cc/sukazyo/cono/morny/bot/command/MornyCommands.java | 7 +++++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1f62c17..0aad69a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.5.1.0 +VERSION = 0.5.1.1 # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index c052959..fd967ea 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny; * the final field that will be updated by gradle automatically. */ public class GradleProjectConfigures { - public static final String VERSION = "0.5.1.0"; - public static final long COMPILE_TIMESTAMP = 1644381263800L; + public static final String VERSION = "0.5.1.1"; + public static final long COMPILE_TIMESTAMP = 1644381533694L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java b/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java index 2a7d03c..07ff390 100644 --- a/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java +++ b/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java @@ -162,8 +162,7 @@ public class MornyCoeur { TrackerDataManager.DAEMON.interrupt(); TrackerDataManager.trackingLock.lock(); if (isRemoveCommandListWhenExit) { - extra().exec(new DeleteMyCommands()); - logger.info("cleaned up command list."); + commandManager.automaticRemoveList(); } } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java index d8979eb..fa4c7f8 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java @@ -8,6 +8,7 @@ import cc.sukazyo.cono.morny.data.TelegramStickers; import cc.sukazyo.untitled.telegram.api.formatting.TGToString; import cc.sukazyo.untitled.util.telegram.object.InputCommand; import com.pengrad.telegrambot.model.BotCommand; +import com.pengrad.telegrambot.model.DeleteMyCommands; import com.pengrad.telegrambot.model.Update; import com.pengrad.telegrambot.model.request.ParseMode; import com.pengrad.telegrambot.request.SendMessage; @@ -90,12 +91,18 @@ public class MornyCommands { public void automaticUpdateList () { BotCommand[] commandList = getCommandListTelegram(); + automaticRemoveList(); MornyCoeur.extra().exec(new SetMyCommands( commandList )); logger.info("automatic updated telegram command list :\n" + commandListToString(commandList)); } + public void automaticRemoveList () { + MornyCoeur.extra().exec(new DeleteMyCommands()); + logger.info("cleaned up command list."); + } + private String commandListToString (@Nonnull BotCommand[] list) { StringBuilder builder = new StringBuilder(); for (BotCommand signal : list) {