FromStranger

abstract class FromStranger @MiraiInternalApi constructor : OnlineMessageSource.Incoming

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

bot
Link copied to clipboard
abstract val bot: Bot
botId
Link copied to clipboard
override val botId: Long

所属 Bot.id

fromId
Link copied to clipboard
override 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.

originalMessage
Link copied to clipboard
abstract val originalMessage: MessageChain

该 source 指代的原消息内容.

sender
Link copied to clipboard
abstract override val sender: Stranger

消息发送人. 可能为 机器人好友群员. 即类型必定为 Bot, FriendMember

subject
Link copied to clipboard
override val subject: Stranger

消息主体. 群消息时为 Group. 好友消息时为 Friend, 临时消息为 Member 不论是机器人接收的消息还是发送的消息, 此属性都指向机器人能进行回复的目标.

target
Link copied to clipboard
override val target: Bot

消息发送目标. 可能为 机器人好友. 即类型必定为 Bot, FriendGroup

targetId
Link copied to clipboard
override val targetId: Long

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

time
Link copied to clipboard
abstract val time: Int

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