Fix BotFaceChangedEvent, Add FriendFaceChangedEvent

This commit is contained in:
Him188 2020-05-09 17:19:02 +08:00
parent 6db2c23a17
commit d16a699810
2 changed files with 15 additions and 3 deletions

View File

@ -493,8 +493,13 @@ private object Transformers528 : Map<Long, MsgType0x210.(QQAndroidBot) -> Sequen
} ?: emptySequence()
}
fun ModCustomFace.transform(): Sequence<Packet> =
sequenceOf(BotFaceChangedEvent(Bot.getInstance(uin)))
fun ModCustomFace.transform(bot: QQAndroidBot): Sequence<Packet> {
if (uin == bot.id) {
return sequenceOf(BotFaceChangedEvent(bot))
}
val friend = bot.getFriendOrNull(uin) ?: return emptySequence()
return sequenceOf(FriendFaceChangedEvent(friend))
}
return@lambda528 vProtobuf.loadAs(SubMsgType0x27MsgBody.serializer()).msgModInfos.asSequence()
@ -504,7 +509,7 @@ private object Transformers528 : Map<Long, MsgType0x210.(QQAndroidBot) -> Sequen
it.msgDelFriend != null -> it.msgDelFriend.transform(bot)
it.msgModGroupProfile != null -> it.msgModGroupProfile.transform(bot)
it.msgModGroupMemberProfile != null -> it.msgModGroupMemberProfile.transform(bot)
it.msgModCustomFace != null -> it.msgModCustomFace.transform()
it.msgModCustomFace != null -> it.msgModCustomFace.transform(bot)
else -> {
bot.network.logger.debug {
"Transformers528 0x27L: new data: ${it._miraiContentToString()}"

View File

@ -95,6 +95,13 @@ data class BotFaceChangedEvent(
override val bot: Bot
) : BotEvent, Packet, AbstractEvent()
/**
* [Friend] 头像被修改
*/
data class FriendFaceChangedEvent(
override val friend: Friend
) : FriendEvent, Packet, AbstractEvent()
// endregion
// region 消息