diff --git a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java index 5c6b711..8795525 100644 --- a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java +++ b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.*; +import java.util.regex.Pattern; @SuppressWarnings({"SameParameterValue"}) public class BotCommandProcess { @@ -522,6 +523,10 @@ public class BotCommandProcess { return reportStore.exists(String.valueOf(illustId)); } + /** + * Tag过滤表达式 + */ + private final static Pattern tagPattern = Pattern.compile(".*R-*18.*"); /** * 检查指定作品是否为r18 * @param illustId 作品Id @@ -538,7 +543,7 @@ public class BotCommandProcess { boolean rawValue = illustInfo.get("xRestrict").getAsInt() != 0; if(!rawValue) { for(JsonElement tag : tags) { - boolean current = tag.getAsString().matches("R-*18") || tag.getAsString().contains("R18"); + boolean current = tagPattern.matcher(tag.getAsString()).matches(); if (current) { rawValue = true; break; diff --git a/src/main/java/net/lamgc/cgj/bot/cache/ImageCacheHandler.java b/src/main/java/net/lamgc/cgj/bot/cache/ImageCacheHandler.java index 9cd4c26..9020ec0 100644 --- a/src/main/java/net/lamgc/cgj/bot/cache/ImageCacheHandler.java +++ b/src/main/java/net/lamgc/cgj/bot/cache/ImageCacheHandler.java @@ -38,7 +38,7 @@ public class ImageCacheHandler implements EventHandler { } try { - log.info("图片 {} Event正在进行...({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode())); + log.debug("图片 {} Event正在进行...({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode())); File storeFile = event.getStoreFile(); log.debug("正在缓存图片 {} (Path: {})", storeFile.getName(), storeFile.getAbsolutePath()); try { @@ -87,7 +87,7 @@ public class ImageCacheHandler implements EventHandler { } event.getImageCache().put(URLs.getResourceName(event.getDownloadLink()), storeFile); } finally { - log.info("图片 {} Event结束({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode())); + log.debug("图片 {} Event结束({})", event.getStoreFile().getName(), Integer.toHexString(event.hashCode())); cacheQueue.remove(event); } }