mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-12 14:00:12 +08:00
Fix new member
This commit is contained in:
parent
9736909d90
commit
d8a5291880
@ -137,11 +137,11 @@ internal class MessageSvc {
|
|||||||
|
|
||||||
object EmptyResponse : GetMsgSuccess(emptyList())
|
object EmptyResponse : GetMsgSuccess(emptyList())
|
||||||
|
|
||||||
private suspend fun MsgComm.Msg.getNewGroup(bot: QQAndroidBot): Group {
|
private suspend fun MsgComm.Msg.getNewGroup(bot: QQAndroidBot): Group? {
|
||||||
val troopNum = bot.network.run {
|
val troopNum = bot.network.run {
|
||||||
FriendList.GetTroopListSimplify(bot.client)
|
FriendList.GetTroopListSimplify(bot.client)
|
||||||
.sendAndExpect<FriendList.GetTroopListSimplify.Response>(retry = 2)
|
.sendAndExpect<FriendList.GetTroopListSimplify.Response>(retry = 2)
|
||||||
}.groups.first { it.groupUin == msgHead.fromUin }
|
}.groups.firstOrNull { it.groupUin == msgHead.fromUin } ?: return null
|
||||||
|
|
||||||
@Suppress("DuplicatedCode")
|
@Suppress("DuplicatedCode")
|
||||||
return GroupImpl(
|
return GroupImpl(
|
||||||
@ -217,7 +217,7 @@ internal class MessageSvc {
|
|||||||
}
|
}
|
||||||
// 新群
|
// 新群
|
||||||
|
|
||||||
val newGroup = msg.getNewGroup(bot)
|
val newGroup = msg.getNewGroup(bot) ?: return@mapNotNull null
|
||||||
bot.groups.delegate.addLast(newGroup)
|
bot.groups.delegate.addLast(newGroup)
|
||||||
return@mapNotNull BotJoinGroupEvent(newGroup)
|
return@mapNotNull BotJoinGroupEvent(newGroup)
|
||||||
} else {
|
} else {
|
||||||
|
@ -416,17 +416,19 @@ internal class OnlinePush {
|
|||||||
bot.network.logger.debug { "OnlinePush528 0x44L: " + msg._miraiContentToString() }
|
bot.network.logger.debug { "OnlinePush528 0x44L: " + msg._miraiContentToString() }
|
||||||
return@lambda528 emptySequence()
|
return@lambda528 emptySequence()
|
||||||
},
|
},
|
||||||
// bot 被踢
|
// bot 在其他客户端被踢或主动退出而同步情况
|
||||||
0xD4L to lambda528 { bot ->
|
0xD4L to lambda528 { bot ->
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SubD4(
|
data class SubD4(
|
||||||
|
// ok
|
||||||
val uin: Long
|
val uin: Long
|
||||||
) : ProtoBuf
|
) : ProtoBuf
|
||||||
|
|
||||||
val uin = vProtobuf.loadAs(SubD4.serializer()).uin
|
val uin = vProtobuf.loadAs(SubD4.serializer()).uin
|
||||||
val group = bot.getGroupByUinOrNull(uin) ?: bot.getGroupOrNull(uin)
|
val group = bot.getGroupByUinOrNull(uin) ?: bot.getGroupOrNull(uin)
|
||||||
// 08 E7 C1 AD B8 02
|
return@lambda528 if (group != null && bot.groups.delegate.remove(group)) {
|
||||||
return@lambda528 group?.let { sequenceOf(BotKickEvent(group)) } ?: emptySequence()
|
sequenceOf(BotLeaveEvent(group))
|
||||||
|
} else emptySequence()
|
||||||
},
|
},
|
||||||
// ModFriendRemark, DelFriend
|
// ModFriendRemark, DelFriend
|
||||||
0x27L to lambda528 { bot ->
|
0x27L to lambda528 { bot ->
|
||||||
|
Loading…
Reference in New Issue
Block a user