diff --git a/Lagrange.OneBot/Core/Entity/Action/Response/OneBotGetFileUrl.cs b/Lagrange.OneBot/Core/Entity/Action/Response/OneBotGetFileUrl.cs new file mode 100644 index 000000000..cfe1eb366 --- /dev/null +++ b/Lagrange.OneBot/Core/Entity/Action/Response/OneBotGetFileUrl.cs @@ -0,0 +1,13 @@ +using System.Text.Json.Serialization; + +namespace Lagrange.OneBot.Core.Entity.Action.Response; + +[Serializable] +public class OneBotGetFileUrl +{ + [JsonPropertyName("group_id")] public uint GroupId { get; set; } + + [JsonPropertyName("file_id")] public string FileId { get; set; } = string.Empty; + + [JsonPropertyName("busid")] public uint BusId { get; set; } +} \ No newline at end of file diff --git a/Lagrange.OneBot/Core/Operation/Group/GroupFSOperations.cs b/Lagrange.OneBot/Core/Operation/Group/GroupFSOperations.cs new file mode 100644 index 000000000..6d450cfc2 --- /dev/null +++ b/Lagrange.OneBot/Core/Operation/Group/GroupFSOperations.cs @@ -0,0 +1,23 @@ +using System.Text.Json; +using System.Text.Json.Nodes; +using Lagrange.Core; +using Lagrange.Core.Common.Interface.Api; +using Lagrange.OneBot.Core.Entity.Action; +using Lagrange.OneBot.Core.Entity.Action.Response; + +namespace Lagrange.OneBot.Core.Operation.Group; + +[Operation("get_group_file_url")] +public class GetGroupFileUrlOperation : IOperation +{ + public async Task HandleOperation(BotContext context, JsonNode? payload) + { + if (payload.Deserialize() is { } url) + { + string raw = await context.FetchGroupFSDownload(url.GroupId, url.FileId); + return new OneBotResult(raw, 0, "ok"); + } + + throw new Exception(); + } +} \ No newline at end of file