yyuueexxiinngg / onebot-kotlin

OneBot标准的Kotlin实现及mirai插件 - 原cqhttp-mirai
GNU Affero General Public License v3.0
584 stars 139 forks source link

[Bug]图片cache错误 #136

Closed ClemChou000 closed 3 years ago

ClemChou000 commented 3 years ago

当使用缓存图片,即控制台输出: 2021-02-08 10:40:35 I/OneBot: 此链接图片已缓存, 如需删除缓存请至 /home/komikun/git_clone/zzl/mcl/data/OneBot/image/DB9370AC97405847BD37143519A373F7.cqimg 时,报错: 2021-02-08 10:40:35 W/stderr: Exception in thread "DefaultDispatcher-worker-1" java.lang.ExceptionInInitializerError 2021-02-08 10:40:35 W/stderr: at com.github.yyuueexxiinngg.onebot.util.CQMessgeParserKt.tryResolveCachedImage(CQMessgeParser.kt:592) 2021-02-08 10:40:35 W/stderr: at com.github.yyuueexxiinngg.onebot.util.CQMessgeParserKt$tryResolveMedia$2.invokeSuspend(CQMessgeParser.kt:418) 2021-02-08 10:40:35 W/stderr: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 2021-02-08 10:40:35 W/stderr: Caused by: java.lang.NoSuchMethodException: net.mamoe.mirai.internal.network.protocol.packet.chat.image.ImgStore$GroupPicUp.invoke(net.mamoe.mirai.internal.network.QQAndroidClient, long, long, [B, int, int, int, int, long, java.lang.String, int, int, int, int, int) 2021-02-08 10:40:35 W/stderr: at java.base/java.lang.Class.getDeclaredMethod(Class.java:2475) 2021-02-08 10:40:35 W/stderr: at com.github.yyuueexxiinngg.onebot.util.ImgUtil.<clinit>(ImgUtil.kt:29) 2021-02-08 10:40:35 W/stderr: ... 8 more

版本信息

  1. onebot-kotlin-0.3.4
  2. mirai-console-2.3.2
  3. mirai-console-terminal-2.3.2
  4. mirai-core-all-2.3.2

顺便提问如何关闭其cache功能,感谢!

ClemChou000 commented 3 years ago

关于cache,已经在配置文件中将图片cache设置为false,但依然存在cache文件,不知道是否为bug

liukairui commented 3 years ago

当使用缓存图片,即控制台输出: 2021-02-08 10:40:35 I/OneBot: 此链接图片已缓存, 如需删除缓存请至 /home/komikun/git_clone/zzl/mcl/data/OneBot/image/DB9370AC97405847BD37143519A373F7.cqimg 时,报错: 2021-02-08 10:40:35 W/stderr: Exception in thread "DefaultDispatcher-worker-1" java.lang.ExceptionInInitializerError 2021-02-08 10:40:35 W/stderr: at com.github.yyuueexxiinngg.onebot.util.CQMessgeParserKt.tryResolveCachedImage(CQMessgeParser.kt:592) 2021-02-08 10:40:35 W/stderr: at com.github.yyuueexxiinngg.onebot.util.CQMessgeParserKt$tryResolveMedia$2.invokeSuspend(CQMessgeParser.kt:418) 2021-02-08 10:40:35 W/stderr: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 2021-02-08 10:40:35 W/stderr: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 2021-02-08 10:40:35 W/stderr: Caused by: java.lang.NoSuchMethodException: net.mamoe.mirai.internal.network.protocol.packet.chat.image.ImgStore$GroupPicUp.invoke(net.mamoe.mirai.internal.network.QQAndroidClient, long, long, [B, int, int, int, int, long, java.lang.String, int, int, int, int, int) 2021-02-08 10:40:35 W/stderr: at java.base/java.lang.Class.getDeclaredMethod(Class.java:2475) 2021-02-08 10:40:35 W/stderr: at com.github.yyuueexxiinngg.onebot.util.ImgUtil.<clinit>(ImgUtil.kt:29) 2021-02-08 10:40:35 W/stderr: ... 8 more

版本信息

  1. onebot-kotlin-0.3.4
  2. mirai-console-2.3.2
  3. mirai-console-terminal-2.3.2
  4. mirai-core-all-2.3.2

顺便提问如何关闭其cache功能,感谢!

相同的问题。

yyuueexxiinngg commented 3 years ago

缓存错误问题经由 #139 修复

配置文件中的cache为控制是否缓存接受到的图片而非Bot发送的图片

发送图片的缓存功能见 标准中对CQ:image的描述:

cache   0 1 只在通过网络 URL 发送时有效,表示是否使用已缓存的文件,默认 1