diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/ContactMessage.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/ContactMessage.kt index a870007ac..6520127d8 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/ContactMessage.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/ContactMessage.kt @@ -97,6 +97,8 @@ abstract class MessagePacketBase : P @WeakRefProperty abstract val sender: TSender + abstract val senderName: String + /** * 消息内容 */ diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessage.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessage.kt index 4f6e01a40..fa4c4879d 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessage.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessage.kt @@ -48,6 +48,7 @@ class FriendMessage constructor( override val sender: Friend by sender.unsafeWeakRef() override val bot: Bot get() = sender.bot override val subject: Friend get() = sender + override val senderName: String get() = sender.nick override val source: OnlineMessageSource.Incoming.FromFriend get() = message.source as OnlineMessageSource.Incoming.FromFriend override fun toString(): String = "FriendMessage(sender=${sender.id}, message=$message)" diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessage.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessage.kt index abb834a16..c5dea5cf7 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessage.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessage.kt @@ -22,7 +22,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef @Suppress("unused", "NOTHING_TO_INLINE") class GroupMessage( - val senderName: String, + override val senderName: String, /** * 发送方权限. */ diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/TempMessage.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/TempMessage.kt index a07ce45fa..f2603a80e 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/TempMessage.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/TempMessage.kt @@ -34,7 +34,7 @@ class TempMessage( override val bot: Bot get() = sender.bot override val subject: Member get() = sender inline val group: Group get() = sender.group - inline val senderName: String get() = sender.nameCardOrNick + override val senderName: String get() = sender.nameCardOrNick override val source: OnlineMessageSource.Incoming.FromTemp get() = message.source as OnlineMessageSource.Incoming.FromTemp override fun toString(): String =