From f21908288cea209e4657c5720dbd9f1d0dc842b7 Mon Sep 17 00:00:00 2001 From: DarkCWK Date: Wed, 10 Jul 2024 00:56:16 +0800 Subject: [PATCH] =?UTF-8?q?[OneBot]=20Unable=20to=20get=20group=20informat?= =?UTF-8?q?ion=20when=20cache=20is=20not=20hit=20(#430)=20=E3=83=BE(?= =?UTF-8?q?=E2=89=A7=E2=96=BD=E2=89=A6*)o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/Operation/Info/GetGroupInfoOperation.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Lagrange.OneBot/Core/Operation/Info/GetGroupInfoOperation.cs b/Lagrange.OneBot/Core/Operation/Info/GetGroupInfoOperation.cs index 9810c19c0..f263e11b6 100644 --- a/Lagrange.OneBot/Core/Operation/Info/GetGroupInfoOperation.cs +++ b/Lagrange.OneBot/Core/Operation/Info/GetGroupInfoOperation.cs @@ -17,8 +17,13 @@ public async Task HandleOperation(BotContext context, JsonNode? pa { var result = (await context.FetchGroups(message.NoCache)).FirstOrDefault(x => x.GroupUin == message.GroupId); - return result == null - ? new OneBotResult(null, -1, "failed") + if (result == null && !message.NoCache) + { + result = (await context.FetchGroups(true)).FirstOrDefault(x => x.GroupUin == message.GroupId); + } + + return result == null + ? new OneBotResult(null, -1, "failed") : new OneBotResult(new OneBotGroup(result), 0, "ok"); }