mirror of
https://github.com/mamoe/mirai.git
synced 2024-12-29 10:00:13 +08:00
Move At.member
from GroupMessage
to MessagePacket
This commit is contained in:
parent
8258fada23
commit
1bcac33151
@ -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]
|
||||
|
||||
|
||||
|
@ -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 下载图片
|
||||
|
Loading…
Reference in New Issue
Block a user