Skip to content

Commit

Permalink
[OneBot] get_cookies Implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan authored and Linwenxuan committed Jan 26, 2024
1 parent fd84b5f commit c94c093
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions Lagrange.OneBot/Core/Operation/Generic/GetCookiesOperation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Text.Json.Nodes;
using Lagrange.Core;
using Lagrange.Core.Common.Interface.Api;
using Lagrange.OneBot.Core.Entity.Action;

namespace Lagrange.OneBot.Core.Operation.Generic;

[Operation("get_cookies")]
public class GetCookiesOperation : IOperation
{
public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject? payload)
{
if (payload?["domain"]?.ToString() is { } domain)
{
var cookies = await context.FetchCookies([domain]);
return new OneBotResult(new JsonObject { { "cookies", cookies[0] } }, 200, "ok");
}

throw new Exception();
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Please use Lagrange.Core responsibly and in accordance with the law.
| [/get_group_member_info] | 🟢 |
| [/get_group_member_list] | 🟢 |
| [/get_group_honor_info] | 🔴 |
| [/get_cookies] | 🔴 |
| [/get_cookies] | 🟢 |
| [/get_csrf_token] | 🔴 |
| [/get_credentials] | 🔴 |
| [/get_record] | 🔴 |
Expand Down

0 comments on commit c94c093

Please sign in to comment.