-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
修复群ID构造的图片发送缓慢,以及无法添加到ForwardMessage中 #1640
Conversation
@Transient | ||
internal var fileId: Int? = null | ||
internal var fileId: Int? = -1 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1636
其实只要改这个fileID就能解决问题,其他的代码可能没有必要,因为fileID不会为null了,本人不是很熟悉kotlin语法
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null is designed
@@ -279,6 +281,17 @@ internal suspend fun <C : Contact> SendMessageHandler<C>.transformSpecialMessage | |||
forward.nodeList.sumOf { it.messageChain.size } | |||
) | |||
forward.nodeList.forEach { tmp.addAll(it.messageChain) } | |||
tmp.forEach { | |||
val tmpContact = contact; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep kotlin style
if (it is FriendImage) { | ||
tmpContact.updateFriendImageForGroupMessage(it) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resp ignored
因为您长时间未进行修改,所以我将会关闭此 PR 并以 #1667 替代 |
修复前:发送由ID构造的图片到群内需要调用GroupPicUp(发送缓慢),私聊却不会,修改为闪照在群内发送也不会
并且添加到ForwardMessage中会无法显示
修复后: ID构造的图片在群内发送不会调用GroupPicUp,跟私聊和闪照时一样,秒发,并且可以添加到ForwardMessage中
只有upload的时候会调用GroupPicUp,用户也可以自行实现ExternalResource检查图片是否过期
其实主要是因为本人写了个涩图插件,用图片ID的方式储存图片,并不需要任何的API获取图片链接下载,或读取本地的文件,主要是为了速度快,已经测试过构造50个图片ID的ForwardMessage 1秒发送完成,机器人发送消息,接收消息
发送离线ID构造的图片,发送upload的图片,发送闪照都是正常的
并且fileID的可见性为internal,也就是其他模块不可调用,修改后不会对其他使用miria的项目造成影响
此次修改内容构造的mirai和插件已经发送给多人进行测试,未发现任何问题