[OneBot] Implemented set_group_leave API
This commit is contained in:
parent
55560cbd2d
commit
af6fc2586e
|
@ -0,0 +1,11 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Lagrange.OneBot.Core.Entity.Action;
|
||||
|
||||
[Serializable]
|
||||
public class OneBotSetGroupLeave
|
||||
{
|
||||
[JsonPropertyName("group_id")] public uint GroupId { get; set; }
|
||||
|
||||
[JsonPropertyName("is_dismiss")] public bool IsDismiss { get; set; }
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using System.Text.Json;
|
||||
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.Group;
|
||||
|
||||
[Operation("set_group_leave")]
|
||||
public class SetGroupLeaveOperation : IOperation
|
||||
{
|
||||
public async Task<OneBotResult> HandleOperation(string echo, BotContext context, JsonObject? payload)
|
||||
{
|
||||
var message = payload.Deserialize<OneBotSetGroupLeave>();
|
||||
|
||||
if (message != null)
|
||||
{
|
||||
bool _ = await context.LeaveGroup(message.GroupId); // TODO: Figure out is_dismiss
|
||||
return new OneBotResult(null, 0, "ok", echo);
|
||||
}
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
|
@ -116,7 +116,7 @@ Please use Lagrange.Core responsibly and in accordance with the law.
|
|||
| [/set_group_anonymous] | 🔴 |
|
||||
| [/set_group_card] | 🟢 |
|
||||
| [/set_group_name] | 🟢 |
|
||||
| [/set_group_leave] | 🔴 |
|
||||
| [/set_group_leave] | 🟢 |
|
||||
| [/set_group_special_title] | 🔴 |
|
||||
| [/set_friend_add_request] | 🔴 |
|
||||
| [/set_group_add_request] | 🔴 |
|
||||
|
|
Loading…
Reference in New Issue