Add XmlMessageHelper

This commit is contained in:
PeratX 2020-03-11 11:13:23 +08:00
parent e9614009f1
commit 292388a1e8

View File

@ -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) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
@DslMarker @DslMarker
annotation class XMLDsl annotation class XMLDsl