Add ContactMessage.senderName

This commit is contained in:
Him188 2020-04-23 11:57:38 +08:00
parent 454205a6af
commit efb186e26d
4 changed files with 5 additions and 2 deletions

View File

@ -97,6 +97,8 @@ abstract class MessagePacketBase<out TSender : User, out TSubject : Contact> : P
@WeakRefProperty
abstract val sender: TSender
abstract val senderName: String
/**
* 消息内容
*/

View File

@ -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)"

View File

@ -22,7 +22,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef
@Suppress("unused", "NOTHING_TO_INLINE")
class GroupMessage(
val senderName: String,
override val senderName: String,
/**
* 发送方权限.
*/

View File

@ -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 =