@SinceMirai("0.38.0") sealed class CustomMessage : SingleMessage
自定义消息
它不会显示在消息文本中, 也不会被其他客户端识别. 只有 mirai 才能识别这些消息.
目前在回复时无法通过 originalMessage 获取自定义类型消息
//Unresolved: samples.CustomMessageIdentifier
See Also
CustomMessageFullData |
class CustomMessageFullData |
Factory |
序列化和反序列化此消息的工厂, 将会自动注册.
应实现为 abstract class Factory<M : CustomMessage> : Key<M> |
JsonSerializerFactory |
使用 Json 作为序列模式的 Factory 推荐在调试时使用此工厂 abstract class JsonSerializerFactory<M : CustomMessage> : Factory<M> |
Key |
companion object Key : Key<CustomMessage> |
ProtoBufSerializerFactory |
使用 ProtoBuf 作为序列模式的 Factory. 推荐使用此工厂 abstract class ProtoBufSerializerFactory<M : CustomMessage> : Factory<M> |
CustomMessageFullDataDeserializeInternalException |
class CustomMessageFullDataDeserializeInternalException : RuntimeException |
CustomMessageFullDataDeserializeUserException |
class CustomMessageFullDataDeserializeUserException : RuntimeException |
getFactory |
获取这个消息的工厂 abstract fun getFactory(): Factory<out CustomMessage> |
typeName |
此 Key 指代的 Message 类型名. 一般为 val typeName: String |
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. |
isPlain |
fun Message.isPlain(): Boolean |
isPlain2 |
fun Message. |
repeat |
fun Message.repeat(count: Int): MessageChain |
repeat2 |
fun Message. |
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 |
CustomMessageMetadata |
自定义消息元数据. abstract class CustomMessageMetadata : CustomMessage, MessageMetadata |