diff --git a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java index 8795525..bc03f7b 100644 --- a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java +++ b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java @@ -141,7 +141,7 @@ public class BotCommandProcess { @Argument(force = false, name = "date") Date queryTime, @Argument(force = false, name = "force") boolean force, @Argument(force = false, name = "mode", defaultValue = "DAILY") String contentMode, - @Argument(force = false, name = "type", defaultValue = "ILLUST") String contentType + @Argument(force = false, name = "type", defaultValue = "ALL") String contentType ) { Date queryDate = queryTime; if (queryDate == null) { @@ -366,8 +366,17 @@ public class BotCommandProcess { PixivURL.getPixivRefererLink(illustId) ); - String imageMsg = CacheStoreCentral.getCentral() - .getImageById(fromGroup, illustId, PixivDownload.PageQuality.REGULAR, 1); + String imageMsg; + try { + imageMsg = CacheStoreCentral.getCentral() + .getImageById(fromGroup, illustId, PixivDownload.PageQuality.REGULAR, 1); + } catch (NoSuchElementException e) { + if(e.getMessage().startsWith("No work found: ")) { + log.warn("作品 {} 不存在, 跳过该作品...", illustId); + continue; + } + throw e; + } if (isNoSafe(illustId, SettingProperties.getProperties(fromGroup), false)) { log.warn("作品Id {} 为R-18作品, 跳过.", illustId); continue; diff --git a/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java b/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java index af965fa..a64ce81 100644 --- a/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java +++ b/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java @@ -403,7 +403,8 @@ public final class CacheStoreCentral { } if (contentOption != null) { try { - searchBuilder.setSearchContentOption(PixivSearchBuilder.SearchContentOption.valueOf(contentOption)); + searchBuilder.setSearchContentOption( + PixivSearchBuilder.SearchContentOption.valueOf(contentOption.trim().toUpperCase())); } catch (IllegalArgumentException e) { log.warn("不支持的SearchContentOption: {}", contentOption); }