[Change] BotCommandProcess 将isNoSafe方法公开;

[Change] MiraiMessageEvent 将UploadImage方法公开;
[Add] MiraiMessageEvent 增加MessageSource枚举类;
This commit is contained in:
2020-04-19 00:31:24 +08:00
parent dbfed874c0
commit b328def8f9
2 changed files with 52 additions and 9 deletions

View File

@ -554,7 +554,15 @@ public class BotCommandProcess {
标签....标签支持搜索吧
*/
private static boolean isNoSafe(int illustId, Properties settingProp, boolean returnRaw) throws IOException {
/**
* 检查指定作品是否为r18
* @param illustId 作品Id
* @param settingProp 配置项
* @param returnRaw 是否返回原始值
* @return 如果为true, 则不为全年龄
* @throws IOException 获取数据时发生异常时抛出
*/
public static boolean isNoSafe(int illustId, Properties settingProp, boolean returnRaw) throws IOException {
boolean rawValue = getIllustInfo(illustId, false).getAsJsonArray("tags").contains(new JsonPrimitive("R-18"));
return returnRaw || settingProp == null ? rawValue : rawValue && !settingProp.getProperty("image.allowR18", "false").equalsIgnoreCase("true");
}