MessageEvent

interface MessageEvent : Event, Packet, BotPassiveEvent

一个消息事件.

See also

判断语境相同

Functions

intercept
Link copied to clipboard
abstract fun intercept()

拦截这个事件

Properties

bot
Link copied to clipboard
abstract override val bot: Bot

与这个消息事件相关的 Bot

isIntercepted
Link copied to clipboard
abstract val isIntercepted: Boolean

事件是否已被拦截.

message
Link copied to clipboard
abstract val message: MessageChain

消息内容.

sender
Link copied to clipboard
abstract val sender: User

发送人.

senderName
Link copied to clipboard
abstract val senderName: String

发送人名称. 由群员发送时为群员名片, 由好友发送时为好友昵称. 使用 User.nameCardOrNick 也能得到相同的结果.

source
Link copied to clipboard
open val source: OnlineMessageSource.Incoming

消息源. 来自 message. 相当于对 messageMessageSource 参数调用 MessageChain.get.

subject
Link copied to clipboard
abstract val subject: Contact

消息事件主体.

time
Link copied to clipboard
abstract val time: Int

消息发送时间戳, 单位为秒. 由服务器提供, 可能与本地有时差.

Inheritors

UserMessageEvent
Link copied to clipboard
OtherClientMessageEvent
Link copied to clipboard
GroupAwareMessageEvent
Link copied to clipboard
GroupMessageEvent
Link copied to clipboard
AbstractMessageEvent
Link copied to clipboard
MessageSyncEvent
Link copied to clipboard

Extensions

buildForwardMessage
Link copied to clipboard
inline fun MessageEvent.buildForwardMessage(context: Contact = this.subject, displayStrategy: ForwardMessage.DisplayStrategy = DisplayStrategy, block: ForwardMessageBuilder.() -> Unit): ForwardMessage

使用 DSL 构建一个 ForwardMessage.

isContextIdenticalWith
Link copied to clipboard
fun MessageEvent.isContextIdenticalWith(another: MessageEvent): Boolean

判断两个 MessageEventMessageEvent.senderMessageEvent.subject 是否相同