mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-20 15:49:15 +08:00
Add ContactMessage.senderName
This commit is contained in:
parent
454205a6af
commit
efb186e26d
@ -97,6 +97,8 @@ abstract class MessagePacketBase<out TSender : User, out TSubject : Contact> : P
|
||||
@WeakRefProperty
|
||||
abstract val sender: TSender
|
||||
|
||||
abstract val senderName: String
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
|
@ -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)"
|
||||
|
@ -22,7 +22,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef
|
||||
|
||||
@Suppress("unused", "NOTHING_TO_INLINE")
|
||||
class GroupMessage(
|
||||
val senderName: String,
|
||||
override val senderName: String,
|
||||
/**
|
||||
* 发送方权限.
|
||||
*/
|
||||
|
@ -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 =
|
||||
|
Loading…
Reference in New Issue
Block a user