mirror of
https://github.com/mamoe/mirai.git
synced 2024-12-29 10:00:13 +08:00
[core] Add MessageChain.deserializeFromMiraiCode
without redundant receiver MessageChain
.
This commit is contained in:
parent
4276b67b2b
commit
4595f937e4
@ -4309,6 +4309,7 @@ public abstract interface class net/mamoe/mirai/message/data/MessageChain : java
|
||||
public fun contains (Lnet/mamoe/mirai/message/data/MessageKey;)Z
|
||||
public static fun deserializeFromJsonString (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static fun deserializeFromJsonString (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static fun deserializeFromMiraiCode (Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static fun deserializeFromMiraiCode (Lnet/mamoe/mirai/message/data/MessageChain;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
@ -4322,7 +4323,9 @@ public final class net/mamoe/mirai/message/data/MessageChain$Companion {
|
||||
public final fun deserializeFromJsonString (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final fun deserializeFromJsonString (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeFromJsonString$default (Lnet/mamoe/mirai/message/data/MessageChain$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final fun deserializeFromMiraiCode (Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final fun deserializeFromMiraiCode (Lnet/mamoe/mirai/message/data/MessageChain;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeFromMiraiCode$default (Lnet/mamoe/mirai/message/data/MessageChain$Companion;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeFromMiraiCode$default (Lnet/mamoe/mirai/message/data/MessageChain$Companion;Lnet/mamoe/mirai/message/data/MessageChain;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
|
@ -4309,6 +4309,7 @@ public abstract interface class net/mamoe/mirai/message/data/MessageChain : java
|
||||
public fun contains (Lnet/mamoe/mirai/message/data/MessageKey;)Z
|
||||
public static fun deserializeFromJsonString (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static fun deserializeFromJsonString (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static fun deserializeFromMiraiCode (Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static fun deserializeFromMiraiCode (Lnet/mamoe/mirai/message/data/MessageChain;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
@ -4322,7 +4323,9 @@ public final class net/mamoe/mirai/message/data/MessageChain$Companion {
|
||||
public final fun deserializeFromJsonString (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final fun deserializeFromJsonString (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeFromJsonString$default (Lnet/mamoe/mirai/message/data/MessageChain$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final fun deserializeFromMiraiCode (Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final fun deserializeFromMiraiCode (Lnet/mamoe/mirai/message/data/MessageChain;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeFromMiraiCode$default (Lnet/mamoe/mirai/message/data/MessageChain$Companion;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public static synthetic fun deserializeFromMiraiCode$default (Lnet/mamoe/mirai/message/data/MessageChain$Companion;Lnet/mamoe/mirai/message/data/MessageChain;Ljava/lang/String;Lnet/mamoe/mirai/contact/Contact;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
public final synthetic fun deserializeJsonToMessageChain (Ljava/lang/String;Lkotlinx/serialization/json/Json;)Lnet/mamoe/mirai/message/data/MessageChain;
|
||||
|
@ -341,11 +341,30 @@ public sealed interface MessageChain :
|
||||
|
||||
/**
|
||||
* 解析形如 "[mirai:]" 的 mirai 码, 即 [CodableMessage.serializeToMiraiCode] 返回的内容.
|
||||
* @param contact 解析语境
|
||||
* @see MiraiCode.deserializeMiraiCode
|
||||
* @since 2.13
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun MessageChain.deserializeFromMiraiCode(miraiCode: String, contact: Contact? = null): MessageChain =
|
||||
public fun deserializeFromMiraiCode(miraiCode: String, contact: Contact? = null): MessageChain =
|
||||
miraiCode.deserializeMiraiCode(contact)
|
||||
|
||||
|
||||
/**
|
||||
* 解析形如 "[mirai:]" 的 mirai 码, 即 [CodableMessage.serializeToMiraiCode] 返回的内容.
|
||||
* @see MiraiCode.deserializeMiraiCode
|
||||
*/
|
||||
@Deprecated(
|
||||
"Parameter MessageChain is redundant, use the overload instead.",
|
||||
ReplaceWith(
|
||||
"MessageChain.deserializeFromMiraiCode(miraiCode, contact)",
|
||||
"net.mamoe.mirai.message.data.MessageChain"
|
||||
)
|
||||
)
|
||||
@Suppress("UnusedReceiverParameter")
|
||||
@JvmStatic
|
||||
public fun MessageChain.deserializeFromMiraiCode(miraiCode: String, contact: Contact? = null): MessageChain =
|
||||
MessageChain.deserializeFromMiraiCode(miraiCode, contact)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,10 @@ public sealed class MessageSource : Message, MessageMetadata, ConstrainSingle {
|
||||
public abstract val targetId: Long // groupCode / friendUin / memberUin
|
||||
|
||||
/**
|
||||
* 该 source 指代的原消息内容.
|
||||
* 该消息源指向的原消息的内容.
|
||||
*
|
||||
* ## 内容不一定完整
|
||||
* 如果消息源是来自一条引用回复, 即 [QuoteReply.source], 那么原消息内容不一定完整.
|
||||
*
|
||||
* 此属性是惰性初始化的: 它只会在第一次调用时初始化, 因为需要反序列化服务器发来的整个包, 相当于接收了一条新消息.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user