diff --git a/AuroraNative/API/Api.cs b/AuroraNative/API/Api.cs index 9e7b596..37d8ac3 100644 --- a/AuroraNative/API/Api.cs +++ b/AuroraNative/API/Api.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; +using System.Net; using System.Threading; using System.Threading.Tasks; @@ -111,7 +112,7 @@ namespace AuroraNative { "group_id", GroupID }, { "messages", Message } }; - //HACK 等昵昵修复获取合并转发的BUG才能继续 + //FIXME 等昵昵修复获取合并转发的BUG才能继续 SendCallVoid(new BaseAPI("send_group_forward_msg", Params, "SendGroupForwardMessage:" + Utils.NowTimeSteamp())); } @@ -364,7 +365,7 @@ namespace AuroraNative } /// - /// 设置群组专属头衔 + /// 设置群组成员专属头衔 /// /// 群号 /// QQ号 @@ -642,20 +643,26 @@ namespace AuroraNative /// /// 图片ID /// 错误返回null,成功返回JObject - public async Task<(List, string)> OCRImage(string Image) + public async Task> OCRImage(string Image) { JObject Json = await SendCallObject(new BaseAPI("ocr_image", new JObject { { "image", Image } }, "OCRImage:" + Utils.NowTimeSteamp())); - return (Json.Value("texts").ToObject>(), Json.Value("language")); + return new Dictionary() { + { "Texts",Json.Value("texts").ToObject>()}, + { "Language",Json.Value("language")} + }; } /// /// 获取群系统消息 /// /// 错误或不存在任何消息返回null,成功返回JObject - public async Task<(List, List)> GetGroupSystemMsg() + public async Task> GetGroupSystemMsg() { JObject Json = await SendCallObject(new BaseAPI("get_group_system_msg", null, "GetGroupSystemMsg:" + Utils.NowTimeSteamp())); - return (Json.Value("invited_requests").ToObject>(), Json.Value("join_requests").ToObject>()); + return new Dictionary() { + { "InvitedRequest",Json.Value("invited_requests").ToObject>()}, + { "JoinRequest",Json.Value("join_requests").ToObject>()} + }; } /// @@ -700,11 +707,13 @@ namespace AuroraNative /// /// 群号 /// 错误返回null,成功返回JObject - public async Task<(List, List)> GetGroupRootFiles(long GroupID) + public async Task> GetGroupRootFiles(long GroupID) { JObject Json = await SendCallObject(new BaseAPI("get_group_root_files", new JObject { { "group_id", GroupID } }, "GetGroupRootFiles:" + Utils.NowTimeSteamp())); - - return (Json.Value("files").ToObject>(), Json.Value("folders").ToObject>()); + return new Dictionary() { + { "Files",Json.Value("files").ToObject>()}, + { "Folder",Json.Value("folders").ToObject>()} + }; } /// @@ -713,7 +722,7 @@ namespace AuroraNative /// 群号 /// 文件夹ID /// 错误返回null,成功返回JObject - public async Task<(List, List)> GetGroupFilesByFolder(long GroupID, string FolderID) + public async Task> GetGroupFilesByFolder(long GroupID, string FolderID) { JObject Params = new JObject { @@ -723,7 +732,10 @@ namespace AuroraNative JObject Json = await SendCallObject(new BaseAPI("get_group_files_by_folder", Params, "GetGroupFilesByFolder:" + Utils.NowTimeSteamp())); - return (Json.Value("files").ToObject>(), Json.Value("folders").ToObject>()); + return new Dictionary() { + { "Files",Json.Value("files").ToObject>()}, + { "Folder",Json.Value("folders").ToObject>()} + }; } /// @@ -749,10 +761,18 @@ namespace AuroraNative /// 获取状态 /// /// 错误返回null,成功返回JObject - public async Task<(bool, RunningStatistics)> GetStatus() + public async Task> GetStatus() { JObject Json = await SendCallObject(new BaseAPI("get_group_info", null, "GetGroupInfo:" + Utils.NowTimeSteamp())); - return (Json.Value("online"), Json.Value("stat")); + return new Dictionary() { + { "AppInitialized",Json.Value("app_initialized")}, + { "AppEnabled",Json.Value("app_enabled")}, + { "PluginsGood",Json.Value("plugins_good")}, + { "AppGood",Json.Value("app_good")}, + { "Online",Json.Value("online")}, + { "Good",Json.Value("good")}, + { "Statistics",Json.Value("stat")} + }; } /// @@ -921,6 +941,27 @@ namespace AuroraNative return (await SendCallObject(new BaseAPI("check_url_safely", new JObject { { "url", URL } }, "CheckURLSafely:" + Utils.NowTimeSteamp()))).Value("level"); } + #region ==额外API== + + /// + /// 获取指定群头像 + /// + /// 群号 + /// 保存路径-包括文件名(通常后缀名是jpg) + /// 是否成功 + public bool DownloadGroupImage(long GroupID,string SaveTo) { + try + { + new WebClient().DownloadFile($"https://p.qlogo.cn/gh/{GroupID}/{GroupID}/100", SaveTo); + return true; + } + catch (Exception _) { + return false; + } + } + + #endregion + #endregion #region --私有函数-- diff --git a/AuroraNative/Abstract/Device.cs b/AuroraNative/Abstract/Device.cs index 5e9c6c1..852ccaf 100644 --- a/AuroraNative/Abstract/Device.cs +++ b/AuroraNative/Abstract/Device.cs @@ -3,7 +3,7 @@ namespace AuroraNative.Type { /// - /// 提供用于描述事件参数的基础类, 该类是抽象的 + /// 提供用于描述登录设备的基础类, 该类是抽象的 /// public abstract class Device { diff --git a/AuroraNative/Abstract/Groups/Groups.cs b/AuroraNative/Abstract/Groups/Groups.cs index f25a762..4cc16ff 100644 --- a/AuroraNative/Abstract/Groups/Groups.cs +++ b/AuroraNative/Abstract/Groups/Groups.cs @@ -21,16 +21,34 @@ namespace AuroraNative.Type.Groups [JsonProperty(PropertyName = "group_name")] public string GroupName; + /// + /// 群备注 + /// + [JsonProperty(PropertyName = "group_memo")] + public string GroupRemark; + + /// + /// 群创建时间 + /// + [JsonProperty(PropertyName = "group_create_time", NullValueHandling = NullValueHandling.Ignore)] + public uint GroupCreateTime; + + /// + /// 群等级 + /// + [JsonProperty(PropertyName = "group_level", NullValueHandling = NullValueHandling.Ignore)] + public uint GroupLevel; + /// /// 现在人数 /// - [JsonProperty(PropertyName = "member_count")] + [JsonProperty(PropertyName = "member_count", NullValueHandling = NullValueHandling.Ignore)] public int MemberCount; /// /// 最大人数 /// - [JsonProperty(PropertyName = "max_member_count")] + [JsonProperty(PropertyName = "max_member_count", NullValueHandling = NullValueHandling.Ignore)] public int MaxMemberCount; #endregion diff --git a/AuroraNative/Abstract/Groups/SystemMessage/JoinRequest.cs b/AuroraNative/Abstract/Groups/SystemMessage/JoinRequest.cs index fb032b6..ebd9746 100644 --- a/AuroraNative/Abstract/Groups/SystemMessage/JoinRequest.cs +++ b/AuroraNative/Abstract/Groups/SystemMessage/JoinRequest.cs @@ -25,7 +25,7 @@ namespace AuroraNative.Type.Groups.SystemMessages /// 验证信息 /// [JsonProperty(PropertyName = "message")] - public long Message; + public string Message; #endregion } diff --git a/AuroraNative/Abstract/RunningStatistics.cs b/AuroraNative/Abstract/RunningStatistics.cs index 9297ebe..1438316 100644 --- a/AuroraNative/Abstract/RunningStatistics.cs +++ b/AuroraNative/Abstract/RunningStatistics.cs @@ -45,7 +45,6 @@ namespace AuroraNative.Type [JsonProperty(PropertyName = "disconnect_times")] public uint DisconnectsCount; - /// /// 账号掉线次数 /// diff --git a/AuroraNative/AuroraNative.csproj b/AuroraNative/AuroraNative.csproj index 9ee0550..4adbbf6 100644 --- a/AuroraNative/AuroraNative.csproj +++ b/AuroraNative/AuroraNative.csproj @@ -21,7 +21,7 @@ false AuroraNative AuroraNative - 1.2.0-Beta + 1.3.0-Beta true true