Skip to content

Commit

Permalink
Update GetGroupHonorInfoOperation.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
ishkong authored Nov 12, 2024
1 parent dfa1803 commit 8bcec63
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Lagrange.OneBot/Core/Operation/Group/GetGroupHonorInfoOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonNode? pa
{
foreach (var (key, value) in Keys)
{
if (json[value] is JsonObject jsonObject) // 神经病 (我也觉得)
if (json.Remove(value, out var node))
{
ProcessJsonObject(jsonObject);
result.TryAdd(key, jsonObject.Deserialize<JsonNode>());
}
else if (json[value] is JsonArray jsonArray)
{
foreach (var item in jsonArray)
if (node is JsonObject jsonObject)
{
ProcessJsonObject(jsonObject);
}
else if (node is JsonArray jsonArray)
{
if (item is JsonObject itemObject)
foreach (var subNode in jsonArray)
{
ProcessJsonObject(itemObject);
if (subNode is JsonObject subObject)
{
ProcessJsonObject(subObject);
}
}
}
if (key.Contains(honorRaw)) result.TryAdd(key, jsonArray.Deserialize<JsonNode>());
if (key.Contains(honorRaw)) result.TryAdd(key, node);
}
}
}
Expand Down

0 comments on commit 8bcec63

Please sign in to comment.