-
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
cannot find member for OnlineMessageSourceFromGroupImpl #2277
Comments
发插件代码 |
没有代码呀,我都没生成插件,源码跑的 |
? |
1 similar comment
? |
发源码 |
//3.5.引用艾特回复(引用艾特/引用含有复读喵)
if(message.any { (it is QuoteReply) && it.source.fromId == robotID } && (message.any { it == At(robotID) } || msgRemoveAt.contains("复读喵")))
{
var msgReply:MessageChain = buildMessageChain { }//构建一个message
val randStart:Int//随机数起点
val randEnd:Int //随机数终点(不包括)
var randCount = 0 //条件不符时重复随机次数
if(groupMessageRecord[groupLocate].messageTotalCount>messageRecordSize)
{//消息超过messageRecordSize条时,使用最早的randomRereadCount条随机
randStart = groupMessageRecord[groupLocate].messageTotalCount
randEnd = groupMessageRecord[groupLocate].messageTotalCount+randomRereadCount
}
else
{//消息未超过messageRecordSize条时,从已有的消息中随机
randStart = 0
randEnd = groupMessageRecord[groupLocate].messageTotalCount
}
var randLocate = (randStart until randEnd).random()%messageRecordSize//随机一条
while(randCount<10)
{//最多随机10次
if(!groupMessageRecord[groupLocate].messageInfo[randLocate].any { (it is QuoteReply) && it.source.fromId == robotID })
{//直到随机到的消息不是引用回复复读喵
msgReply = groupMessageRecord[groupLocate].messageInfo[randLocate]
break
}
randLocate = (randStart until randEnd).random()%messageRecordSize
randCount++
}
if(msgReply == buildMessageChain { }) msgReply += PlainText("想和本喵说什么呀,请开始你的表演~")
msgReply = msgReply.filter { it != At(robotID) }.toMessageChain() //去掉消息中艾特复读喵的部分
if(!msgReply.isContentBlank()) group.sendMessage(msgReply)//回复-----异常发生处---------
return@subscribeAlways
} |
那个 groupMessageRecord[groupLocate] 就是一个存了那个群最近的message |
最近又多次发生这个异常 |
java.lang.IllegalStateException: cannot find member for OnlineMessageSourceFromGroupImpl. msg=[net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm$Msg@59d294ee] |
java.lang.IllegalStateException: cannot find member for OnlineMessageSourceFromGroupImpl. msg=[net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm$Msg@100ecc0c] |
java.lang.IllegalStateException: cannot find member for OnlineMessageSourceFromGroupImpl. msg=[net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm$Msg@5befc691] |
PluginMain.kt的行数不一样是由于前面的代码变动,异常发生处还是原来那句if(!msgReply.isContentBlank()) group.sendMessage(msgReply),不过那里的代码过于老旧,但总之就是将一个群成员的消息存储起来,当这个群成员被踢后发送出来它的消息的时候会出异常 |
问题描述
事情是这样:某位群员16:12发送了一句广告,随后多次发送,机器人有记录消息后随机复读消息的功能,在16:29踢出那位群员后,16:36机器人随机到了那位群员的消息,但sendMessage时失败(找不到消息source的成员)。
按理说他虽然被踢了但是他之前发的消息应该是存在的呀,莫非说群员被踢了,他的消息就不能复读了
复现
本地缓存存储一位群成员的消息,在群成员被踢后向该群发送该消息。
mirai-core 版本
2.13.0-RC
bot-protocol
ANDROID_PAD
其他组件版本
No response
系统日志
网络日志
No response
补充信息
有群友说可以去 PR 个 MemberExited(狗头
The text was updated successfully, but these errors were encountered: