Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上传好友图片时出现内部错误 #1317

Closed
Him188 opened this issue Jun 8, 2021 · 13 comments
Closed

上传好友图片时出现内部错误 #1317

Him188 opened this issue Jun 8, 2021 · 13 comments
Labels
C 优先级: 最高 t:bug 类型: bug x:protocol 属性: 协议相关
Milestone

Comments

@Him188
Copy link
Member

Him188 commented Jun 8, 2021

语言是Java,实现代码如下:

event.getSender().sendMessage(
                        event.getSender().uploadImage(ExternalResource.create(pictureData))
);

pictureData为byte[] 在群消息中发送图片正常,唯独私聊不行。是我的使用方法有问题吗?
Mirai版本为 2.6.4

控制台报错内容:

2021-06-08 16:53:27 W/stderr: Exception in thread "pool-2-thread-1" java.lang.IllegalStateException: para error
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.contact.AbstractUser.uploadImage$suspendImpl(AbstractUser.kt:193)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.contact.AbstractUser$uploadImage$1.invokeSuspend(AbstractUser.kt)
2021-06-08 16:53:27 W/stderr:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:113)
2021-06-08 16:53:27 W/stderr:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:362)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:396)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:388)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:293)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.ResumeAwaitOnCompletion.invoke(JobSupport.kt:1408)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:318)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.JobSupport.tryFinalizeSimpleState(JobSupport.kt:295)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:853)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.JobSupport.makeCompleting$kotlinx_coroutines_core(JobSupport.kt:803)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.CompletableDeferredImpl.complete(CompletableDeferred.kt:92)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler$PacketListener.complete(QQAndroidBotNetworkHandler.kt)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler.handlePacket(QQAndroidBotNetworkHandler.kt:636)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler$generifiedParsePacket$2.invokeSuspend(QQAndroidBotNetworkHandler.kt:604)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler$generifiedParsePacket$2.invoke(QQAndroidBotNetworkHandler.kt)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.protocol.packet.KnownPacketFactories.handleIncomingPacket$mirai_core(PacketFactory.kt:285)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.protocol.packet.KnownPacketFactories.parseIncomingPacket(PacketFactory.kt:247)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler.generifiedParsePacket(QQAndroidBotNetworkHandler.kt:595)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler.parsePacket(QQAndroidBotNetworkHandler.kt:590)
2021-06-08 16:53:27 W/stderr:   at net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler$parsePacketAsync$1.invokeSuspend(QQAndroidBotNetworkHandler.kt:572)
2021-06-08 16:53:27 W/stderr:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
2021-06-08 16:53:27 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Originally posted by @eiriksgata in #1316

@Him188 Him188 added M 优先级: 主要 t:problem 类型: 不容易归类为特性或 bug 的综合问题 x:protocol 属性: 协议相关 x:question 标签: 需要更多信息 labels Jun 8, 2021
@Him188 Him188 added this to the Backlog milestone Jun 8, 2021
@Him188 Him188 changed the title 私聊发送消息出现内部错误 私聊发送图片消息出现内部错误 Jun 8, 2021
@Him188 Him188 changed the title 私聊发送图片消息出现内部错误 上传好友图片时出现内部错误 Jun 8, 2021
@WiseClock
Copy link

試了一下……

InputStream is = new URL(url).openStream();
byte[] bytes = IOUtils.toByteArray(is);
source.getGroup().sendMessage(source.getGroup().uploadImage(ExternalResource.create(is)));
source.getGroup().sendMessage(source.getGroup().uploadImage(ExternalResource.create(bytes)));
source.getSender().sendMessage(source.getSender().uploadImage(ExternalResource.create(is)));
source.getSender().sendMessage(source.getSender().uploadImage(ExternalResource.create(bytes)));

我這邊不管是發is還是發bytes都問題……
也是2.6.4

@eiriksgata
Copy link

经过一番测试后发现,与版本无关。与QQ账号有关,换了一个正常使用的QQ账号后,就可以正常私聊发送图片了。之前出现这个问题的账号是属于 仅加了一个好友,但是不属于新注册的,非经常在线的开发测试账号。

@weiba0
Copy link

weiba0 commented Jun 9, 2021

2.6.5 也是报错 Recv: Failed(message=para error)

@weiba0
Copy link

weiba0 commented Jun 9, 2021

经过一番测试后发现,与版本无关。与QQ账号有关,换了一个正常使用的QQ账号后,就可以正常私聊发送图片了。之前出现这个问题的账号是属于 仅加了一个好友,但是不属于新注册的,非经常在线的开发测试账号。

我的账号经常登录但是依旧出现了这个问题

@eiriksgata
Copy link

经过一番测试后发现,与版本无关。与QQ账号有关,换了一个正常使用的QQ账号后,就可以正常私聊发送图片了。之前出现这个问题的账号是属于 仅加了一个好友,但是不属于新注册的,非经常在线的开发测试账号。

我的账号经常登录但是依旧出现了这个问题

那不是很清楚,我这边是现在用开发测试账号在本地电脑PC(windows10)100%的情况无法发送出(双方均有好友的情况下,并且以前可以正常使用私聊发送图片的功能),然后我改为用常驻的云端机器人账号转到我的电脑上使用,可以正常发出(多次测试100%都可以发出)。

@sandtechnology
Copy link
Collaborator

para error是parameter error,也就是参数错误 请确定使用的图片无损坏情况且为QQ支持的格式(PNG/GIF/JPG)

@weiba0
Copy link

weiba0 commented Jun 9, 2021

para error是parameter error,也就是参数错误 请确定使用的图片无损坏情况且为QQ支持的格式(PNG/GIF/JPG)

图片是正常的 且格式设置了过滤 也是正常的
先前可以正常发送,突然全部为para error

@eiriksgata
Copy link

para error是parameter error,也就是参数错误 请确定使用的图片无损坏情况且为QQ支持的格式(PNG/GIF/JPG)

该说法并不成立,同一张图片,在群消息正常发出,但私聊无法发出,所以与参数无关

@eiriksgata
Copy link

para error是parameter error,也就是参数错误 请确定使用的图片无损坏情况且为QQ支持的格式(PNG/GIF/JPG)

图片是正常的 且格式设置了过滤 也是正常的
先前可以正常发送,突然全部为para error

你试下群消息能正常发出吗

@weiba0
Copy link

weiba0 commented Jun 9, 2021

para error是parameter error,也就是参数错误 请确定使用的图片无损坏情况且为QQ支持的格式(PNG/GIF/JPG)

图片是正常的 且格式设置了过滤 也是正常的
先前可以正常发送,突然全部为para error

你试下群消息能正常发出吗

确实 发送到群正常的,那我想可不可以用发送到群的返回 来发送给好友

@weiba0
Copy link

weiba0 commented Jun 9, 2021

para error是parameter error,也就是参数错误 请确定使用的图片无损坏情况且为QQ支持的格式(PNG/GIF/JPG)

图片是正常的 且格式设置了过滤 也是正常的
先前可以正常发送,突然全部为para error

你试下群消息能正常发出吗

确实 发送到群正常的,那我想可不可以用发送到群的返回 来发送给好友

这可能不是正常的使用方式,但是我通过group来uploadImage 后 讲返回的图片id 用 friend.sendMessage发送后 绕过了这一报错,使其可以发送给好友
那我觉得可能是friend下的uploadImage 出了问题

@DearAhri520
Copy link

同问,我也遇到了这个问题

@Him188
Copy link
Member Author

Him188 commented Jun 9, 2021

看起来是协议最近发生了变动,欢迎 PR 帮助

@Him188 Him188 added C 优先级: 最高 and removed M 优先级: 主要 labels Jun 9, 2021
@Karlatemp Karlatemp added t:bug 类型: bug and removed t:problem 类型: 不容易归类为特性或 bug 的综合问题 x:question 标签: 需要更多信息 labels Jun 10, 2021
@Karlatemp Karlatemp modified the milestones: Backlog, 2.7-M1 Jun 10, 2021
@Him188 Him188 removed this from the 2.7-M1 milestone Jun 10, 2021
@Him188 Him188 added this to the 2.6.6 milestone Jun 10, 2021
Him188 pushed a commit that referenced this issue Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C 优先级: 最高 t:bug 类型: bug x:protocol 属性: 协议相关
Projects
None yet
Development

No branches or pull requests

7 participants