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) {