mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: fix #104
This commit is contained in:
parent
9d893b481d
commit
8e0ae6f85b
@ -90,18 +90,19 @@ internal object SendForwardMessage : IActionHandler() {
|
|||||||
if (it.asJsonObject["type"].asStringOrNull != "node") return@map ForwardMsgNode.EmptyNode // 过滤非node类型消息段
|
if (it.asJsonObject["type"].asStringOrNull != "node") return@map ForwardMsgNode.EmptyNode // 过滤非node类型消息段
|
||||||
it.asJsonObject["data"].asJsonObject.let { data ->
|
it.asJsonObject["data"].asJsonObject.let { data ->
|
||||||
if (data.containsKey("content")) {
|
if (data.containsKey("content")) {
|
||||||
data["content"].asJsonArray.forEach { msg ->
|
if (data["content"] is JsonArray) {
|
||||||
if (msg.asJsonObject["type"].asStringOrNull == "node") {
|
data["content"].asJsonArray.forEach { msg ->
|
||||||
LogCenter.log("合并转发消息不支持嵌套", Level.ERROR)
|
if (msg.asJsonObject["type"].asStringOrNull == "node") {
|
||||||
return@map ForwardMsgNode.EmptyNode
|
LogCenter.log("合并转发消息不支持嵌套", Level.ERROR)
|
||||||
|
return@map ForwardMsgNode.EmptyNode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ForwardMsgNode.MessageNode(
|
ForwardMsgNode.MessageNode(
|
||||||
name = data["name"].asStringOrNull ?: "",
|
name = data["name"].asStringOrNull ?: "",
|
||||||
content = data["content"]
|
content = data["content"]
|
||||||
)
|
)
|
||||||
}
|
} else ForwardMsgNode.MessageIdNode(data["id"].asInt)
|
||||||
else ForwardMsgNode.MessageIdNode(data["id"].asInt)
|
|
||||||
}
|
}
|
||||||
}.map {
|
}.map {
|
||||||
if (it is ForwardMsgNode.MessageIdNode) {
|
if (it is ForwardMsgNode.MessageIdNode) {
|
||||||
@ -131,7 +132,9 @@ internal object SendForwardMessage : IActionHandler() {
|
|||||||
suspendCoroutine {
|
suspendCoroutine {
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
var msgId: Long = 0
|
var msgId: Long = 0
|
||||||
msgId = MessageHelper.sendMessageWithMsgId(MsgConstant.KCHATTYPEC2C, selfUin, node.content!!.let { msg ->
|
msgId = MessageHelper.sendMessageWithMsgId(MsgConstant.KCHATTYPEC2C,
|
||||||
|
selfUin,
|
||||||
|
node.content!!.let { msg ->
|
||||||
if (msg is JsonArray) msg else MessageHelper.decodeCQCode(msg.asString)
|
if (msg is JsonArray) msg else MessageHelper.decodeCQCode(msg.asString)
|
||||||
},
|
},
|
||||||
{ code, why ->
|
{ code, why ->
|
||||||
@ -154,9 +157,10 @@ internal object SendForwardMessage : IActionHandler() {
|
|||||||
|
|
||||||
return ok(
|
return ok(
|
||||||
ForwardMessageResult(
|
ForwardMessageResult(
|
||||||
msgId = uniseq.first,
|
msgId = uniseq.first,
|
||||||
forwardId = ""
|
forwardId = ""
|
||||||
), echo = echo)
|
), echo = echo
|
||||||
|
)
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
return error("error: $it", echo)
|
return error("error: $it", echo)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user