Add group and senderName shortcuts to TempMessage

This commit is contained in:
Him188 2020-04-13 10:27:39 +08:00
parent 2b95bea8da
commit f7f3e88878

View File

@ -1,7 +1,9 @@
package net.mamoe.mirai.message
import net.mamoe.mirai.Bot
import net.mamoe.mirai.contact.Group
import net.mamoe.mirai.contact.Member
import net.mamoe.mirai.contact.nameCardOrNick
import net.mamoe.mirai.event.BroadcastControllable
import net.mamoe.mirai.message.data.MessageChain
import net.mamoe.mirai.message.data.MessageSource
@ -27,6 +29,8 @@ class TempMessage(
override val sender: Member by sender.unsafeWeakRef()
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 source: OnlineMessageSource.Incoming.FromTemp get() = message.source as OnlineMessageSource.Incoming.FromTemp
override fun toString(): String =