-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Linwenxuan
authored and
Linwenxuan
committed
Jan 26, 2024
1 parent
fd84b5f
commit c94c093
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
Lagrange.OneBot/Core/Operation/Generic/GetCookiesOperation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters