OfflineMessageSource

abstract class OfflineMessageSource : MessageSource

由一条消息中的 QuoteReply 得到的, 或通过 MessageSourceBuilder 手动构建的 MessageSource.

此消息源可能来自一条与机器人无关的消息, 因此缺少相关发送环境信息, 无法提供 sendertarget 对象的获取.

要获得 OfflineMessageSource, 使用 MessageSourceBuilder. 或通过 OnlineMessageSource.toOffline 转换得到 (一般没有必要).

Constructors

OfflineMessageSource
Link copied to clipboard
fun OfflineMessageSource()

Types

Key
Link copied to clipboard

Functions

contentEquals
Link copied to clipboard
open fun contentEquals(another: String, ignoreCase: Boolean = false): Boolean

判断内容是否与 another 相等.

open fun contentEquals(another: Message, ignoreCase: Boolean = false): Boolean

判断内容是否与 another 相等即 thisanothercontentToString 相等.

open fun contentEquals(another: Message, ignoreCase: Boolean = false, strict: Boolean = false): Boolean

判断内容是否与 another 相等即 thisanothercontentToString 相等. stricttrue 时, 还会额外判断每个消息元素的类型, 顺序和属性. 如 Image 会判断 Image.imageId

contentToString
Link copied to clipboard
abstract fun contentToString(): String

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

followedBy
Link copied to clipboard
open fun followedBy(tail: Message): MessageChain

thistail 连接.

plus
Link copied to clipboard
open operator fun plus(another: Array<out Message>): MessageChain

another 按顺序连接到这个消息的尾部.

open operator fun plus(another: CharSequence): MessageChain

another 作为 PlainText 连接到这个消息的尾部.

open operator fun plus(another: String): MessageChain

another 作为 PlainText 连接到这个消息的尾部.

open operator fun plus(another: Iterable<String>): MessageChain

another 按顺序连接到这个消息的尾部.

open operator fun plus(another: Iterable<Message>): MessageChain

another 按顺序连接到这个消息的尾部.

open operator fun plus(another: Sequence<Message>): MessageChain

another 按顺序连接到这个消息的尾部.

open operator fun plus(another: Message): MessageChain

another 按顺序连接到这个消息的尾部.

open operator fun plus(another: MessageChain): MessageChain

another 按顺序连接到这个消息的尾部.

open operator fun plus(another: SingleMessage): MessageChain

another 连接到这个消息的尾部.

toString
Link copied to clipboard
override fun toString(): String

返回 "[mirai:source:${ids.contentToString()},${internalIds.contentToString()}]"

Properties

botId
Link copied to clipboard
abstract val botId: Long

所属 Bot.id

fromId
Link copied to clipboard
abstract val fromId: Long

发送人用户 ID.

ids
Link copied to clipboard
abstract val ids: IntArray

消息 ids (序列号). 在获取失败时 (概率很低) 为空数组.

internalIds
Link copied to clipboard
abstract val internalIds: IntArray

内部 ids. 仅用于协议模块使用

key
Link copied to clipboard
override val key: MessageKey<MessageSource>

用于判断是否为同一种元素的 MessageKey. 使用多态类型 MessageKey 最上层的 MessageKey.

kind
Link copied to clipboard
abstract val kind: MessageSourceKind

消息种类

originalMessage
Link copied to clipboard
abstract val originalMessage: MessageChain

该 source 指代的原消息内容.

targetId
Link copied to clipboard
abstract val targetId: Long

消息发送目标用户或群号码.

time
Link copied to clipboard
abstract val time: Int

发送时间时间戳, 单位为秒.