[Add] BotEventHandler 增加启动预处理方法;

[Add] BotAdminCommandProcess 增加推送功能相关管理命令;
[Change] RandomIntervalSendTimer 调整Timer管理过程;
[Change] BotCommandProcess ranking方法对参数错误的处理调整为返回错误信息;
[Fix] RankingUpdateTimer 修复参数错误的问题;
This commit is contained in:
2020-04-23 16:23:06 +08:00
parent 21466a49f9
commit 19605a9401
5 changed files with 248 additions and 25 deletions

View File

@ -175,18 +175,22 @@ public class BotCommandProcess {
}
}
PixivURL.RankingMode mode = PixivURL.RankingMode.MODE_DAILY;
PixivURL.RankingMode mode;
try {
mode = PixivURL.RankingMode.valueOf("MODE_" + contentMode.toUpperCase());
String rankingModeValue = contentMode.toUpperCase();
mode = PixivURL.RankingMode.valueOf(rankingModeValue.startsWith("MODE_") ? rankingModeValue : "MODE_" + rankingModeValue);
} catch (IllegalArgumentException e) {
log.warn("无效的RankingMode值: {}", contentMode);
return "参数无效, 请查看帮助信息";
}
PixivURL.RankingContentType type = PixivURL.RankingContentType.TYPE_ILLUST;
PixivURL.RankingContentType type;
try {
type = PixivURL.RankingContentType.valueOf("TYPE_" + contentType.toUpperCase());
String contentTypeValue = contentType.toUpperCase();
type = PixivURL.RankingContentType.valueOf(contentTypeValue.startsWith("TYPE_") ? contentTypeValue : "TYPE_" + contentTypeValue);
} catch (IllegalArgumentException e) {
log.warn("无效的RankingContentType值: {}", contentType);
return "参数无效, 请查看帮助信息";
}
if(!type.isSupportedMode(mode)) {