[[[release 0.5.1.1]]]

## 🧯Bug Fix

- 修复误将 /o 命令写为 /on 命令的问题
- 使 Morny 在更新命令表时会先执行一遍命令表删除
This commit is contained in:
A.C.Sukazyo Eyre 2022-03-15 17:43:19 +08:00
commit 864800122e
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
4 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,6 @@
## Core ## Core
VERSION = 0.5.0.6 VERSION = 0.5.1.1
# dependencies # dependencies

View File

@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny;
* the final field that will be updated by gradle automatically. * the final field that will be updated by gradle automatically.
*/ */
public class GradleProjectConfigures { public class GradleProjectConfigures {
public static final String VERSION = "0.5.0.6"; public static final String VERSION = "0.5.1.1";
public static final long COMPILE_TIMESTAMP = 1644378359640L; public static final long COMPILE_TIMESTAMP = 1644381533694L;
} }

View File

@ -162,8 +162,7 @@ public class MornyCoeur {
TrackerDataManager.DAEMON.interrupt(); TrackerDataManager.DAEMON.interrupt();
TrackerDataManager.trackingLock.lock(); TrackerDataManager.trackingLock.lock();
if (isRemoveCommandListWhenExit) { if (isRemoveCommandListWhenExit) {
extra().exec(new DeleteMyCommands()); commandManager.automaticRemoveList();
logger.info("cleaned up command list.");
} }
} }

View File

@ -8,6 +8,7 @@ import cc.sukazyo.cono.morny.data.TelegramStickers;
import cc.sukazyo.untitled.telegram.api.formatting.TGToString; import cc.sukazyo.untitled.telegram.api.formatting.TGToString;
import cc.sukazyo.untitled.util.telegram.object.InputCommand; import cc.sukazyo.untitled.util.telegram.object.InputCommand;
import com.pengrad.telegrambot.model.BotCommand; import com.pengrad.telegrambot.model.BotCommand;
import com.pengrad.telegrambot.model.DeleteMyCommands;
import com.pengrad.telegrambot.model.Update; import com.pengrad.telegrambot.model.Update;
import com.pengrad.telegrambot.model.request.ParseMode; import com.pengrad.telegrambot.model.request.ParseMode;
import com.pengrad.telegrambot.request.SendMessage; import com.pengrad.telegrambot.request.SendMessage;
@ -90,12 +91,18 @@ public class MornyCommands {
public void automaticUpdateList () { public void automaticUpdateList () {
BotCommand[] commandList = getCommandListTelegram(); BotCommand[] commandList = getCommandListTelegram();
automaticRemoveList();
MornyCoeur.extra().exec(new SetMyCommands( MornyCoeur.extra().exec(new SetMyCommands(
commandList commandList
)); ));
logger.info("automatic updated telegram command list :\n" + commandListToString(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) { private String commandListToString (@Nonnull BotCommand[] list) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for (BotCommand signal : list) { for (BotCommand signal : list) {
@ -143,7 +150,7 @@ public class MornyCommands {
/// ///
private static class ON implements ITelegramCommand { private static class ON implements ITelegramCommand {
@Nonnull @Override public String getName () { return "/on"; } @Nonnull @Override public String getName () { return "/o"; }
@Nullable @Nullable
@Override public String[] getAliases () { return null; } @Override public String[] getAliases () { return null; }
@Nonnull @Override public String getParamRule () { return ""; } @Nonnull @Override public String getParamRule () { return ""; }