Skip to content

Commit

Permalink
uwu
Browse files Browse the repository at this point in the history
  • Loading branch information
sisi0318 committed Jan 20, 2025
1 parent 6368369 commit 587ea99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Lagrange.Core/Common/Interface/Api/OperationExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ public static Task<MessageResult> FriendShake(this BotContext bot, uint friendUi
public static Task<List<string>?> FetchMarketFaceKey(this BotContext bot, List<string> faceIds)
=> bot.ContextCollection.Business.OperationLogic.FetchMarketFaceKey(faceIds);

public static async Task<List<string>> FetchRkey(this BotContext bot)
{
var fetchRkeyEvent = FetchRKeyEvent.Create();
var events = await bot.ContextCollection.Business.SendEvent(fetchRkeyEvent);
return ((FetchRKeyEvent)events[0]).RKeys;
}
// public static async Task<List<string>> FetchRkey(this BotContext bot)
// {
// var fetchRkeyEvent = FetchRKeyEvent.Create();
// var events = await bot.ContextCollection.Business.SendEvent(fetchRkeyEvent);
// return ((FetchRKeyEvent)events[0]).RKeys;
// }

/// <summary>
/// Set the avatar of the bot itself
Expand Down
9 changes: 7 additions & 2 deletions Lagrange.OneBot/Core/Operation/Generic/FetchRkeyOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using Lagrange.Core;
using Lagrange.Core.Common.Interface.Api;
using Lagrange.OneBot.Core.Entity.Action;
using Lagrange.Core.Internal.Event.System;
using Lagrange.OneBot.Core.Entity.Action.Response;

namespace Lagrange.OneBot.Core.Operation.Generic;

Expand All @@ -10,7 +12,10 @@ public class FetchRkeyOperation : IOperation
{
public async Task<OneBotResult> HandleOperation(BotContext context, JsonNode? payload)
{
var rkeys = await context.FetchRkey();
return new OneBotResult(new JsonObject { { "private_rkey", rkeys[0] }, { "group_rkey", rkeys[1] } }, 0, "ok");
var fetchRKeyEvent = FetchRKeyEvent.Create();
var events = await context.ContextCollection.Business.SendEvent(fetchRKeyEvent);
var rKeyEvent = (FetchRKeyEvent)events[0];
if (rKeyEvent.ResultCode != 0) return new OneBotResult(null, rKeyEvent.ResultCode, "failed");
return new OneBotResult(new JsonObject { { "private_rkey", rKeyEvent.RKeys[0].Rkey }, { "group_rkey", rKeyEvent.RKeys[1].Rkey } }, 0, "ok");
}
}

0 comments on commit 587ea99

Please sign in to comment.