diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/XML.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/XML.kt index a61c6d535..339f4b483 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/XML.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/XML.kt @@ -104,6 +104,29 @@ class XMLMessageBuilder( } } +@MiraiExperimentalAPI +object XmlMessageHelper { + fun share(u: String, title: String?, content: String?, image: String?) = buildXMLMessage { + templateId = 12345 + serviceId = 1 + action = "web" + brief = "[分享] " + (title ?: "") + url = u + item { + layout = 2 + if (image != null) { + picture(image) + } + if (title != null) { + title(title) + } + if (content != null) { + summary(content) + } + } + } +} + @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE) @DslMarker -annotation class XMLDsl \ No newline at end of file +annotation class XMLDsl