mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 19:24:53 +08:00
使 Morny 在更新命令表时会先执行一遍命令表删除
This commit is contained in:
parent
e3c026d16a
commit
60bf104e94
@ -1,6 +1,6 @@
|
|||||||
## Core
|
## Core
|
||||||
|
|
||||||
VERSION = 0.5.1.0
|
VERSION = 0.5.1.1
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
|
|
||||||
|
@ -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.1.0";
|
public static final String VERSION = "0.5.1.1";
|
||||||
public static final long COMPILE_TIMESTAMP = 1644381263800L;
|
public static final long COMPILE_TIMESTAMP = 1644381533694L;
|
||||||
}
|
}
|
||||||
|
@ -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.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user