mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: fix #26
This commit is contained in:
parent
0a41429d71
commit
5200a4d8d4
@ -95,9 +95,27 @@ internal object MessageMaker {
|
|||||||
"reply" to MessageMaker::createReplyElem,
|
"reply" to MessageMaker::createReplyElem,
|
||||||
"touch" to MessageMaker::createTouchElem,
|
"touch" to MessageMaker::createTouchElem,
|
||||||
"weather" to MessageMaker::createWeatherElem,
|
"weather" to MessageMaker::createWeatherElem,
|
||||||
|
"json" to MessageMaker::createJsonElem,
|
||||||
//"multi_msg" to MessageMaker::createLongMsgStruct,
|
//"multi_msg" to MessageMaker::createLongMsgStruct,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private suspend fun createJsonElem(
|
||||||
|
chatType: Int,
|
||||||
|
msgId: Long,
|
||||||
|
peerId: String,
|
||||||
|
data: JsonObject
|
||||||
|
): Result<MsgElement> {
|
||||||
|
data.checkAndThrow("data")
|
||||||
|
val jsonStr = data["data"].let {
|
||||||
|
if (it is JsonObject) it.asJsonObject.toString() else it.asString
|
||||||
|
}
|
||||||
|
val element = MsgElement()
|
||||||
|
element.elementType = MsgConstant.KELEMTYPEARKSTRUCT
|
||||||
|
val ark = ArkElement(jsonStr, null, null)
|
||||||
|
element.arkElement = ark
|
||||||
|
return Result.success(element)
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun createTouchElem(
|
private suspend fun createTouchElem(
|
||||||
chatType: Int,
|
chatType: Int,
|
||||||
msgId: Long,
|
msgId: Long,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user