mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-13 03:16:05 +08:00
Add XmlMessageHelper
This commit is contained in:
parent
e9614009f1
commit
292388a1e8
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user