Skip to content

Commit c94c093

Browse files
LinwenxuanLinwenxuan
authored andcommitted
[OneBot] get_cookies Implemented
1 parent fd84b5f commit c94c093

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Text.Json.Nodes;
2+
using Lagrange.Core;
3+
using Lagrange.Core.Common.Interface.Api;
4+
using Lagrange.OneBot.Core.Entity.Action;
5+
6+
namespace Lagrange.OneBot.Core.Operation.Generic;
7+
8+
[Operation("get_cookies")]
9+
public class GetCookiesOperation : IOperation
10+
{
11+
public async Task<OneBotResult> HandleOperation(BotContext context, JsonObject? payload)
12+
{
13+
if (payload?["domain"]?.ToString() is { } domain)
14+
{
15+
var cookies = await context.FetchCookies([domain]);
16+
return new OneBotResult(new JsonObject { { "cookies", cookies[0] } }, 200, "ok");
17+
}
18+
19+
throw new Exception();
20+
}
21+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Please use Lagrange.Core responsibly and in accordance with the law.
136136
| [/get_group_member_info] | 🟢 |
137137
| [/get_group_member_list] | 🟢 |
138138
| [/get_group_honor_info] | 🔴 |
139-
| [/get_cookies] | 🔴 |
139+
| [/get_cookies] | 🟢 |
140140
| [/get_csrf_token] | 🔴 |
141141
| [/get_credentials] | 🔴 |
142142
| [/get_record] | 🔴 |

0 commit comments

Comments
 (0)