Move At.member from GroupMessage to MessagePacket

This commit is contained in:
Him188 2020-02-20 11:52:26 +08:00
parent 8258fada23
commit 1bcac33151
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,6 @@ import net.mamoe.mirai.contact.Group
import net.mamoe.mirai.contact.Member
import net.mamoe.mirai.contact.MemberPermission
import net.mamoe.mirai.event.Event
import net.mamoe.mirai.message.data.At
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.MessageChain
import net.mamoe.mirai.utils.getValue
@ -38,7 +37,6 @@ class GroupMessage(
override val subject: Group get() = group
inline fun At.member(): Member = group[this.target]
inline fun Long.member(): Member = group[this]

View File

@ -115,6 +115,8 @@ abstract class MessagePacketBase<TSender : QQ, TSubject : Contact>(_bot: Bot) :
*/
inline fun QQ.at(): At = At(this as? Member ?: error("`QQ.at` can only be used in GroupMessage"))
inline fun At.member(): Member = (this@MessagePacketBase as? GroupMessage)?.group?.get(this.target) ?: error("`At.member` can only be used in GroupMessage")
// endregion
// region 下载图片