mirai-core / net.mamoe.mirai.message.data / At

At

data class At : MessageContent

At 一个群成员. 只能发送给一个群.

See Also

AtAll

Types

Key

companion object Key : Key<At>

Constructors

<init>

构造一个 At 实例. 这是唯一的公开的构造方式.

At(member: Member)

Properties

display

val display: String

target

val target: Long

Functions

contentToString

转为最接近官方格式的字符串. 如 At(member) + "test" 将转为 "@群名片 test".

fun contentToString(): String

equals

fun equals(other: Any?): Boolean

followedBy

thistail 连接.

fun followedBy(tail: Message): MessageChain

followedBy1

fun followedBy1(tail: Message): CombinedMessage

hashCode

fun hashCode(): Int

toString

得到包含 mirai 消息元素代码的, 易读的字符串. 如 At(member) + "test" 将转为 "[mirai:at:qqId]test"

fun toString(): String

Companion Object Properties

typeName

Key 指代的 Message 类型名. 一般为 class.simpleName, 如 "QuoteReply", "PlainText"

val typeName: String

Companion Object Functions

_lowLevelConstructAtInstance

构造一个 At, 仅供内部使用, 否则可能造成消息无法发出的问题.

fun _lowLevelConstructAtInstance(target: Long, display: String): At

Extension Functions

flatten

扁平化 Message

fun Message.flatten(): Sequence<SingleMessage>

isContentEmpty

判断消息内容是否为空.

fun Message.isContentEmpty(): Boolean

isContentNotEmpty

fun Message.isContentNotEmpty(): Boolean

isNotPlain

fun Message.isNotPlain(): Boolean

isNotPlain2

fun Message.isNotPlain2(): Boolean

isPlain

fun Message.isPlain(): Boolean

isPlain2

fun Message.isPlain2(): Boolean

repeat

fun Message.repeat(count: Int): MessageChain

repeat2

fun Message.repeat2(count: Int): MessageChain

sendTo

suspend fun <C : Contact> Message.sendTo(contact: C): MessageReceipt<C>

times

operator fun Message.times(count: Int): MessageChain

toForwardMessage

转换为 ForwardMessage

fun Message.toForwardMessage(sender: User, time: Int = currentTimeSeconds.toInt(), displayStrategy: DisplayStrategy = DisplayStrategy): ForwardMessage
fun Message.toForwardMessage(senderId: Long, senderName: String, time: Int = currentTimeSeconds.toInt(), displayStrategy: DisplayStrategy = DisplayStrategy): ForwardMessage