mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-22 01:30:41 +08:00
Fix potential NoSuchElementException when member is kicked
This commit is contained in:
parent
35f2335a5f
commit
d7ab2c1bae
@ -185,8 +185,24 @@ internal class NewContact {
|
|||||||
}
|
}
|
||||||
5 -> {
|
5 -> {
|
||||||
val group = bot.getGroupOrNull(groupCode) ?: return null
|
val group = bot.getGroupOrNull(groupCode) ?: return null
|
||||||
val operator = group[actionUin]
|
when (groupMsgType) {
|
||||||
BotLeaveEvent.Kick(operator)
|
13 -> { // 成员主动退出, 机器人是管理员, 接到通知
|
||||||
|
// 但无法获取是哪个成员.
|
||||||
|
null
|
||||||
|
}
|
||||||
|
7 -> { // 机器人被踢
|
||||||
|
val operator = group[actionUin]
|
||||||
|
BotLeaveEvent.Kick(operator)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
throw contextualBugReportException(
|
||||||
|
"解析 NewContact.SystemMsgNewGroup, subType=5",
|
||||||
|
this._miraiContentToString(),
|
||||||
|
null,
|
||||||
|
"并描述此时机器人是否被踢出群等"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else -> throw contextualBugReportException(
|
else -> throw contextualBugReportException(
|
||||||
"parse SystemMsgNewGroup",
|
"parse SystemMsgNewGroup",
|
||||||
|
Loading…
Reference in New Issue
Block a user