mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-03 02:04:59 +08:00
Make FriendEvent.bot final
This commit is contained in:
parent
5be7f2bb2d
commit
1db7bba837
@ -411,7 +411,7 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf(
|
||||
return this.msgFrdRmk?.asSequence()?.mapNotNull {
|
||||
val friend = bot.getFriendOrNull(it.fuin) ?: return@mapNotNull null
|
||||
// TODO: 2020/4/10 ADD REMARK QUERY
|
||||
FriendRemarkChangeEvent(bot, friend, it.rmkName)
|
||||
FriendRemarkChangeEvent(friend, it.rmkName)
|
||||
} ?: emptySequence()
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf(
|
||||
return sequenceOf(BotAvatarChangedEvent(bot))
|
||||
}
|
||||
val friend = bot.getFriendOrNull(uin) ?: return emptySequence()
|
||||
return sequenceOf(FriendFaceChangedEvent(friend))
|
||||
return sequenceOf(FriendAvatarChangedEvent(friend))
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ sealed class BotOfflineEvent : BotEvent, AbstractEvent() {
|
||||
}
|
||||
|
||||
/**
|
||||
* [Bot] 主动或被动重新登录.
|
||||
* [Bot] 主动或被动重新登录. 在此事件广播前就已经登录完毕.
|
||||
*/
|
||||
data class BotReloginEvent internal constructor(
|
||||
override val bot: Bot,
|
||||
@ -91,14 +91,14 @@ data class BotReloginEvent internal constructor(
|
||||
) : BotEvent, BotActiveEvent, AbstractEvent()
|
||||
|
||||
/**
|
||||
* [Bot] 头像被修改(通过其他客户端修改了Bot的头像)
|
||||
* [Bot] 头像被修改(通过其他客户端修改了头像). 在此事件广播前就已经修改完毕.
|
||||
*/
|
||||
data class BotAvatarChangedEvent(
|
||||
override val bot: Bot
|
||||
) : BotEvent, Packet, AbstractEvent()
|
||||
|
||||
/**
|
||||
* [Friend] 头像被修改
|
||||
* [Friend] 头像被修改. 在此事件广播前就已经修改完毕.
|
||||
*/
|
||||
data class FriendAvatarChangedEvent(
|
||||
override val friend: Friend
|
||||
@ -658,7 +658,6 @@ data class MemberUnmuteEvent(
|
||||
* 好友昵称改变事件. 目前仅支持解析 (来自 PC 端的修改).
|
||||
*/
|
||||
data class FriendRemarkChangeEvent(
|
||||
override val bot: Bot,
|
||||
override val friend: Friend,
|
||||
val newName: String
|
||||
) : FriendEvent, Packet, AbstractEvent()
|
||||
@ -671,18 +670,14 @@ data class FriendAddEvent(
|
||||
* 新好友. 已经添加到 [Bot.friends]
|
||||
*/
|
||||
override val friend: Friend
|
||||
) : FriendEvent, Packet, AbstractEvent() {
|
||||
override val bot: Bot get() = friend.bot
|
||||
}
|
||||
) : FriendEvent, Packet, AbstractEvent()
|
||||
|
||||
/**
|
||||
* 好友已被删除的事件.
|
||||
*/
|
||||
data class FriendDeleteEvent(
|
||||
override val friend: Friend
|
||||
) : FriendEvent, Packet, AbstractEvent() {
|
||||
override val bot: Bot get() = friend.bot
|
||||
}
|
||||
) : FriendEvent, Packet, AbstractEvent()
|
||||
|
||||
/**
|
||||
* 一个账号请求添加机器人为好友的事件
|
||||
|
@ -7,6 +7,8 @@
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("WRONG_MODIFIER_CONTAINING_DECLARATION")
|
||||
|
||||
package net.mamoe.mirai.event.events
|
||||
|
||||
import net.mamoe.mirai.Bot
|
||||
@ -84,6 +86,5 @@ val GroupOperableEvent.operatorOrBot: Member
|
||||
*/
|
||||
interface FriendEvent : BotEvent {
|
||||
val friend: Friend
|
||||
override val bot: Bot
|
||||
get() = friend.bot
|
||||
final override val bot: Bot get() = friend.bot
|
||||
}
|
Loading…
Reference in New Issue
Block a user