mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-06 09:00:14 +08:00
* try to fix #358 according to @Mar8s comment * Disable mirror * Cancel group coroutine when bot leave group and fire event separately * Re-add 0x82 and 0x83 * Revert else logic * Fix build Co-authored-by: Him188 <Him188@mamoe.net>
This commit is contained in:
parent
22112d222b
commit
2d0fa69899
@ -205,28 +205,41 @@ internal object OnlinePushPbPushTransMsg :
|
|||||||
A8 32 51 A1
|
A8 32 51 A1
|
||||||
83 3E 03 3F A2 06 B4 B4 BD A8 D5 DF 00 30 39 32 46 45 30 36 31 41 33 37 36 43 44 35 37 35 37 39 45 37 32 34 44 37 37 30 36 46 39 39 43 35 35 33 33 31 34 44 32 44 46 35 45 42 43 31 31 36
|
83 3E 03 3F A2 06 B4 B4 BD A8 D5 DF 00 30 39 32 46 45 30 36 31 41 33 37 36 43 44 35 37 35 37 39 45 37 32 34 44 37 37 30 36 46 39 39 43 35 35 33 33 31 34 44 32 44 46 35 45 42 43 31 31 36
|
||||||
*/
|
*/
|
||||||
readUInt().toLong() // group, uin or code ?
|
readUInt().toLong() // groupUin
|
||||||
|
readByte().toInt() // follow type
|
||||||
discardExact(1)
|
|
||||||
val target = readUInt().toLong()
|
val target = readUInt().toLong()
|
||||||
val type = readUByte().toInt()
|
val type = readUByte().toInt()
|
||||||
val operator = readUInt().toLong()
|
val operator = readUInt().toLong()
|
||||||
val groupUin = content.fromUin
|
val groupUin = content.fromUin
|
||||||
|
|
||||||
when (type) {
|
when (type) {
|
||||||
0x82 -> bot.getGroupByUinOrNull(groupUin)?.let { group ->
|
2, 0x82 -> bot.getGroupByUinOrNull(groupUin)?.let { group ->
|
||||||
val member = group.getOrNull(target) as? MemberImpl ?: return null
|
if (target == bot.id) {
|
||||||
return MemberLeaveEvent.Quit(member.also {
|
return BotLeaveEvent.Active(group).also {
|
||||||
member.cancel(CancellationException("Leaved actively"))
|
group.cancel(CancellationException("Leaved actively"))
|
||||||
group.members.delegate.remove(member)
|
bot.groups.delegate.remove(group)
|
||||||
})
|
}
|
||||||
|
} else {
|
||||||
|
val member = group.getOrNull(target) as? MemberImpl ?: return null
|
||||||
|
return MemberLeaveEvent.Quit(member.also {
|
||||||
|
member.cancel(CancellationException("Leaved actively"))
|
||||||
|
group.members.delegate.remove(member)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
0x83 -> bot.getGroupByUin(groupUin).let { group ->
|
3, 0x83 -> bot.getGroupByUin(groupUin).let { group ->
|
||||||
val member = group.getOrNull(target) as? MemberImpl ?: return null
|
if (target == bot.id) {
|
||||||
return MemberLeaveEvent.Kick(member.also {
|
return BotLeaveEvent.Kick(group.members[operator]).also {
|
||||||
member.cancel(CancellationException("Leaved actively"))
|
group.cancel(CancellationException("Being kicked"))
|
||||||
group.members.delegate.remove(member)
|
bot.groups.delegate.remove(group)
|
||||||
}, group.members[operator])
|
}
|
||||||
|
} else {
|
||||||
|
val member = group.getOrNull(target) as? MemberImpl ?: return null
|
||||||
|
return MemberLeaveEvent.Kick(member.also {
|
||||||
|
member.cancel(CancellationException("Being kicked"))
|
||||||
|
group.members.delegate.remove(member)
|
||||||
|
}, group.members[operator])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
|
package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
|
||||||
|
|
||||||
import kotlinx.coroutines.CancellationException
|
|
||||||
import kotlinx.coroutines.cancel
|
|
||||||
import kotlinx.io.core.ByteReadPacket
|
import kotlinx.io.core.ByteReadPacket
|
||||||
import kotlinx.io.core.discardExact
|
import kotlinx.io.core.discardExact
|
||||||
import kotlinx.io.core.readBytes
|
import kotlinx.io.core.readBytes
|
||||||
@ -478,20 +476,23 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf(
|
|||||||
return@lambda528 emptySequence()
|
return@lambda528 emptySequence()
|
||||||
},
|
},
|
||||||
// bot 在其他客户端被踢或主动退出而同步情况
|
// bot 在其他客户端被踢或主动退出而同步情况
|
||||||
0xD4L to lambda528 { bot ->
|
0xD4L to lambda528 { _ ->
|
||||||
// this.soutv("0x210")
|
// this.soutv("0x210")
|
||||||
@Serializable
|
/* @Serializable
|
||||||
data class SubD4(
|
data class SubD4(
|
||||||
// ok
|
// 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)
|
||||||
return@lambda528 if (group != null && bot.groups.delegate.remove(group)) {
|
return@lambda528 if (group != null && bot.groups.delegate.remove(group)) {
|
||||||
group.cancel(CancellationException("Being kicked"))
|
group.cancel(CancellationException("Being kicked"))
|
||||||
sequenceOf(BotLeaveEvent.Active(group))
|
sequenceOf(BotLeaveEvent.Active(group))
|
||||||
} else emptySequence()
|
} else emptySequence()*/
|
||||||
|
|
||||||
|
//ignore
|
||||||
|
return@lambda528 emptySequence()
|
||||||
},
|
},
|
||||||
//戳一戳信息等
|
//戳一戳信息等
|
||||||
0x122L to lambda528 { bot, _ ->
|
0x122L to lambda528 { bot, _ ->
|
||||||
|
Loading…
Reference in New Issue
Block a user