Skip to content

Commit

Permalink
修复 Lagrange 回复下的 chat-command 使用 (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvolvedGhost authored May 28, 2024
1 parent d53033f commit ef9584a
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ internal object OnebotMessages {
if (source != null) add(source)

val app = bot.appName.lowercase()
for (o in json) {

var hasQuote = false

for ((i, o) in json.withIndex()) {
val obj = o.jsonObject
val type = obj["type"].string
val data = obj["data"]?.jsonObject ?: buildJsonObject { }
Expand All @@ -252,6 +255,8 @@ internal object OnebotMessages {
"record" -> add(audioFromFile(data["file"].string))
"video" -> add(videoFromFile(data["file"].string))
"at" -> {
if (i == 1 && hasQuote)
continue
if (data["qq"].string.lowercase() == "all")
add(AtAll)
else
Expand Down Expand Up @@ -324,6 +329,11 @@ internal object OnebotMessages {
.time(msgData.time)
val kind = if (msgData?.groupId == 0L) MessageSourceKind.FRIEND else MessageSourceKind.GROUP

// lagrange
if (i == 0 && app == "lagrange.onebot") {
hasQuote = true
}

add(QuoteReply(msgSource.build(bot.id, kind)))
}

Expand Down

0 comments on commit ef9584a

Please sign in to comment.