@gsycl2004
貌似是风控的问题,bot多挂几天试试,实测有效。
Y
yuhanzero 发布的帖子
-
RE: 如何发送本地图片?
val kotlinVersion = "1.5.30" kotlin("jvm") version kotlinVersion kotlin("plugin.serialization") version kotlinVersion id("net.mamoe.mirai-console") version "2.7.0"
-
如何发送本地图片?
新人,仿照非官方帮助文档的图片部分写法,文字发送成功了,图片没有发送,但是日志上面显示发送了。问题和这类似,按照大佬的解答没能解决,希望得到帮助。
代码:this.globalEventChannel().subscribeAlways<GroupMessageEvent> { event -> if (message.contentToString() == "#tx") { var contact = event.group var ex = File("D:\\tx.jpg").toExternalResource("jpg") var img = contact.uploadImage(ex) ex.close() contact.sendMessage(img) contact.sendMessage("tx") } }
日志:
2022-01-04 V/Bot.xxxx: [开发测试(xxxx)] yuhanzero(xxxx) -> #tx 2022-01-04 V/Bot.xxxx: Event: BeforeImageUploadEvent(target=Group(xxxx), source=net.mamoe.mirai.internal.utils.ExternalResourceImplByFile@165ad5e7) 2022-01-04 V/Bot.xxxx: Event: Succeed(target=Group(xxxx), source=net.mamoe.mirai.internal.utils.ExternalResourceImplByFile@165ad5e7, image=[mirai:image:{DC3BA8C8-0E76-6F68-349F-919A0E78147B}.jpg]) 2022-01-04 V/Bot.xxxx: Event: GroupMessagePreSendEvent(target=Group(xxxx), message=[mirai:image:{DC3BA8C8-0E76-6F68-349F-919A0E78147B}.jpg]) 2022-01-04 V/Bot.xxxx: Group(xxxx) <- [mirai:image:{DC3BA8C8-0E76-6F68-349F-919A0E78147B}.jpg] 2022-01-04 V/Bot.xxxx: Event: GroupMessagePostSendEvent(target=Group(xxxx), message=[mirai:image:{DC3BA8C8-0E76-6F68-349F-919A0E78147B}.jpg], exception=null, receipt=net.mamoe.mirai.message.MessageReceipt@1363a1e1) 2022-01-04 V/Bot.xxxx: Event: GroupMessagePreSendEvent(target=Group(xxxx), message=tx) 2022-01-04 V/Bot.xxxx: Group(xxxx) <- tx 2022-01-04 V/Bot.xxxx: Event: GroupMessagePostSendEvent(target=Group(xxxx), message=tx, exception=null, receipt=net.mamoe.mirai.message.MessageReceipt@46da27a8)