diff --git a/src/EleCho.GoCqHttpSdk.CommandExecuting/EleCho.GoCqHttpSdk.CommandExecuting.csproj b/src/EleCho.GoCqHttpSdk.CommandExecuting/EleCho.GoCqHttpSdk.CommandExecuting.csproj index ff721cc..258b334 100644 --- a/src/EleCho.GoCqHttpSdk.CommandExecuting/EleCho.GoCqHttpSdk.CommandExecuting.csproj +++ b/src/EleCho.GoCqHttpSdk.CommandExecuting/EleCho.GoCqHttpSdk.CommandExecuting.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;netstandard2.0 + net8.0;net6.0;net7.0;netstandard2.0 enable latest 1.0.8 diff --git a/src/EleCho.GoCqHttpSdk.MessageMatching/EleCho.GoCqHttpSdk.MessageMatching.csproj b/src/EleCho.GoCqHttpSdk.MessageMatching/EleCho.GoCqHttpSdk.MessageMatching.csproj index 36fa7e9..2b5d25b 100644 --- a/src/EleCho.GoCqHttpSdk.MessageMatching/EleCho.GoCqHttpSdk.MessageMatching.csproj +++ b/src/EleCho.GoCqHttpSdk.MessageMatching/EleCho.GoCqHttpSdk.MessageMatching.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;netstandard2.0 + net8.0;net6.0;net7.0;netstandard2.0 enable latest 1.0.6 diff --git a/src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj b/src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj index 9c5f15b..34c9147 100644 --- a/src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj +++ b/src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;netstandard2.0 + net8.0;net6.0;net7.0;netstandard2.0 enable latest SlimeNull @@ -30,11 +30,7 @@ - - - - - + diff --git a/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs index f57523e..0c13277 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs @@ -26,27 +26,33 @@ public abstract record class CqMessagePostContext : CqPostContext /// /// 消息 ID /// - public long MessageId { get; set; } + public long MessageId { get; internal set; } /// /// 用户 ID /// - public long UserId { get; set; } + public long UserId { get; internal set; } + + /// + /// 发送者 + /// + //对我没初始化但这是个abstract class并且派生类型都初始化了这个所以没问题...吧... -by gdr2333 + public CqMessageSender Sender { get; internal set; } = new CqMessageSender(); /// /// 消息实例 /// - public CqMessage Message { get; set; } = new CqMessage(0); + public CqMessage Message { get; internal set; } = new CqMessage(0); /// /// 原始消息 (CQ 码) /// - public string RawMessage { get; set; } = string.Empty; + public string RawMessage { get; internal set; } = string.Empty; /// /// 字体 /// - public int Font { get; set; } + public int Font { get; internal set; } internal override void ReadModel(CqPostModel model) { @@ -60,6 +66,7 @@ internal override void ReadModel(CqPostModel model) Message = new CqMessage(msgModel.message.Select(CqMsg.FromModel)); RawMessage = msgModel.raw_message; Font = msgModel.font; + Sender = new CqMessageSender(msgModel.sender); } } } \ No newline at end of file diff --git a/src/EleCho.GoCqHttpSdk/Post/Base/CqPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/Base/CqPostContext.cs index d80aba6..514206d 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Base/CqPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Base/CqPostContext.cs @@ -29,12 +29,12 @@ internal CqPostContext() /// /// 机器人 QQ ID /// - public long SelfId { get; set; } + public long SelfId { get; internal set; } /// /// 上报时间 /// - public DateTime Time { get; set; } + public DateTime Time { get; internal set; } internal abstract object? QuickOperationModel { get; } diff --git a/src/EleCho.GoCqHttpSdk/Post/Base/CqSelfMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/Base/CqSelfMessagePostContext.cs index be37901..792bd88 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Base/CqSelfMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Base/CqSelfMessagePostContext.cs @@ -22,27 +22,27 @@ public abstract record class CqSelfMessagePostContext : CqPostContext /// /// 消息 ID /// - public long MessageId { get; set; } + public long MessageId { get; internal set; } /// /// 用户 ID /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 消息实例 /// - public CqMessage Message { get; set; } = new CqMessage(0); + public CqMessage Message { get; internal set; } = new CqMessage(0); /// /// 原始消息 (CQ 码) /// - public string RawMessage { get; set; } = string.Empty; + public string RawMessage { get; internal set; } = string.Empty; /// /// 字体 /// - public int Font { get; set; } + public int Font { get; internal set; } internal override void ReadModel(CqPostModel model) { diff --git a/src/EleCho.GoCqHttpSdk/Post/CqClientStatusChangedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqClientStatusChangedPostContext.cs index fe8fbf4..940ff8f 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqClientStatusChangedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqClientStatusChangedPostContext.cs @@ -19,12 +19,12 @@ internal CqClientStatusChangedPostContext() { } /// /// 是否在线 /// - public bool IsOnline { get; set; } + public bool IsOnline { get; internal set; } /// /// 客户端 /// - public CqDevice Client { get; set; } = new CqDevice(); + public CqDevice Client { get; internal set; } = new CqDevice(); internal override object? QuickOperationModel => null; internal override void ReadModel(CqPostModel model) diff --git a/src/EleCho.GoCqHttpSdk/Post/CqFriendAddedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqFriendAddedPostContext.cs index 2ffc2ba..29a10e5 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqFriendAddedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqFriendAddedPostContext.cs @@ -16,7 +16,7 @@ public record class CqFriendAddedPostContext : CqNoticePostContext /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } internal CqFriendAddedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqFriendMessageRecalledPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqFriendMessageRecalledPostContext.cs index 0e474b5..eb8e375 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqFriendMessageRecalledPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqFriendMessageRecalledPostContext.cs @@ -16,12 +16,12 @@ public record class CqFriendMessageRecalledPostContext : CqNoticePostContext /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 消息 ID /// - public long MessageId { get; set; } + public long MessageId { get; internal set; } internal CqFriendMessageRecalledPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqFriendRequestPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqFriendRequestPostContext.cs index ed07f0f..0ce12e1 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqFriendRequestPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqFriendRequestPostContext.cs @@ -17,17 +17,17 @@ public record class CqFriendRequestPostContext : CqRequestPostContext /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 验证消息 /// - public string Comment { get; set; } = string.Empty; + public string Comment { get; internal set; } = string.Empty; /// /// 请求标志 (用来处理请求) /// - public string Flag { get; set; } = string.Empty; + public string Flag { get; internal set; } = string.Empty; internal CqFriendRequestPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupAdminChangedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupAdminChangedPostContext.cs index 494a37c..48e94f3 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupAdminChangedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupAdminChangedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群管理员变更上报上下文 /// - public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext + public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext, IGroupPostContext { /// /// 通知类型: 群管理员 @@ -16,17 +17,17 @@ public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext /// /// 变更类型 /// - public CqGroupAdminChangeType ChangeType { get; set; } + public CqGroupAdminChangeType ChangeType { get; internal set; } /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } internal CqGroupAdministratorChangedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupEssenceChangedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupEssenceChangedPostContext.cs index 1163792..555c2ef 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupEssenceChangedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupEssenceChangedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群精华消息变更上报上下文 /// - public record class CqGroupEssenceChangedPostContext : CqNoticePostContext + public record class CqGroupEssenceChangedPostContext : CqNoticePostContext, IGroupPostContext { internal CqGroupEssenceChangedPostContext() { } @@ -18,22 +19,27 @@ internal CqGroupEssenceChangedPostContext() { } /// /// 变更类型 /// - public CqEssenceChangeType ChangeType { get; set; } + public CqEssenceChangeType ChangeType { get; internal set; } /// /// 消息发送者 QQ /// - public long SenderId { get; set; } + public long SenderId { get; internal set; } /// /// 操作者 QQ /// - public long OperatorId { get; set; } + public long OperatorId { get; internal set; } /// /// 消息 ID /// - public long MessageId { get; set; } + public long MessageId { get; internal set; } + + /// + /// 群号 + /// + public long GroupId { get; internal set; } internal override object? QuickOperationModel => null; internal override void ReadModel(CqPostModel model) @@ -47,6 +53,7 @@ internal override void ReadModel(CqPostModel model) SenderId = noticeModel.sender_id; OperatorId = noticeModel.operator_id; MessageId = noticeModel.message_id; + GroupId = noticeModel.group_id; } } } \ No newline at end of file diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupFileUploadedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupFileUploadedPostContext.cs index 20748e4..e06f5eb 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupFileUploadedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupFileUploadedPostContext.cs @@ -1,5 +1,5 @@ using EleCho.GoCqHttpSdk; - +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -7,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群文件上传上报上下文 /// - public record class CqGroupFileUploadedPostContext : CqNoticePostContext + public record class CqGroupFileUploadedPostContext : CqNoticePostContext, IGroupPostContext { /// /// 通知类型: 群文件上传 @@ -17,17 +17,17 @@ public record class CqGroupFileUploadedPostContext : CqNoticePostContext /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 群文件 /// - public CqGroupUploadedFile File { get; set; } = new CqGroupUploadedFile(); + public CqGroupUploadedFile File { get; internal set; } = new CqGroupUploadedFile(); internal CqGroupFileUploadedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupLuckyKingNoticedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupLuckyKingNoticedPostContext.cs index 8be8900..61a4da4 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupLuckyKingNoticedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupLuckyKingNoticedPostContext.cs @@ -16,17 +16,17 @@ public record class CqGroupLuckyKingNoticedPostContext : CqNotifyNoticePostConte /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ (红包发送者 QQ) /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 目标 QQ (运气王 QQ) /// - public long TargetId { get; set; } + public long TargetId { get; internal set; } internal CqGroupLuckyKingNoticedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberBanChangedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberBanChangedPostContext.cs index 9cbcc54..f3bef43 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberBanChangedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberBanChangedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; using System; @@ -7,7 +8,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群成员禁言状态变更上报上下文 /// - public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext + public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext, IGroupPostContext { /// /// 通知类型: 群禁言 @@ -17,27 +18,27 @@ public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext /// /// 变更类型 /// - public CqGroupBanChangeType ChangeType { get; set; } + public CqGroupBanChangeType ChangeType { get; internal set; } /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 操作者 QQ /// - public long OperatorId { get; set; } + public long OperatorId { get; internal set; } /// /// 时长 (如果为 0 则是取消禁言) /// - public TimeSpan Duration { get; set; } + public TimeSpan Duration { get; internal set; } internal CqGroupMemberBanChangedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberDecreasedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberDecreasedPostContext.cs index fb55656..bc0a7de 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberDecreasedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberDecreasedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群成员减少上报上下文 /// - public record class CqGroupMemberDecreasedPostContext : CqNoticePostContext + public record class CqGroupMemberDecreasedPostContext : CqNoticePostContext, IGroupPostContext { /// /// 通知类型: 群成员减少 diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberHonorChangedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberHonorChangedPostContext.cs index bb9c3fb..8bced28 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberHonorChangedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberHonorChangedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群成员群荣誉变更上报上下文 /// - public record class CqGroupMemberHonorChangedPostContext : CqNotifyNoticePostContext + public record class CqGroupMemberHonorChangedPostContext : CqNotifyNoticePostContext, IGroupPostContext { /// /// 上报类型: 通知 @@ -26,17 +27,17 @@ public record class CqGroupMemberHonorChangedPostContext : CqNotifyNoticePostCon /// /// 群荣誉类型 /// - public CqHonorType HonorType { get; set; } + public CqHonorType HonorType { get; internal set; } /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } internal CqGroupMemberHonorChangedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberIncreasedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberIncreasedPostContext.cs index a885281..d19fbb3 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberIncreasedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberIncreasedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群成员增加上报上下文 /// - public record class CqGroupMemberIncreasedPostContext : CqNoticePostContext + public record class CqGroupMemberIncreasedPostContext : CqNoticePostContext, IGroupPostContext { /// /// 通知类型: 群成员增加 @@ -16,22 +17,22 @@ public record class CqGroupMemberIncreasedPostContext : CqNoticePostContext /// /// 变更类型 /// - public CqGroupIncreaseChangeType ChangeType { get; set; } + public CqGroupIncreaseChangeType ChangeType { get; internal set; } /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 操作者 QQ /// - public long OperatorId { get; set; } + public long OperatorId { get; internal set; } internal CqGroupMemberIncreasedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberNicknameChangedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberNicknameChangedPostContext.cs index e9597aa..0a9da74 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberNicknameChangedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberNicknameChangedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群成员群昵称变更上报上下文 /// - public record class CqGroupMemberNicknameChangedPostContext : CqNoticePostContext + public record class CqGroupMemberNicknameChangedPostContext : CqNoticePostContext, IGroupPostContext { /// /// 通知类型: @@ -16,22 +17,22 @@ public record class CqGroupMemberNicknameChangedPostContext : CqNoticePostContex /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 新昵称 /// - public string NewNickname { get; set; } = string.Empty; + public string NewNickname { get; internal set; } = string.Empty; /// /// 旧昵称 /// - public string OldNickname { get; set; } = string.Empty; + public string OldNickname { get; internal set; } = string.Empty; internal CqGroupMemberNicknameChangedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberTitleChangeNoticedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberTitleChangeNoticedPostContext.cs index bd98621..f481406 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberTitleChangeNoticedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMemberTitleChangeNoticedPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群成员头衔变更上报上下文 /// - public record class CqGroupMemberTitleChangeNoticedPostContext : CqNotifyNoticePostContext + public record class CqGroupMemberTitleChangeNoticedPostContext : CqNotifyNoticePostContext, IGroupPostContext { /// /// 通知类型: 群成员头衔 @@ -16,17 +17,17 @@ public record class CqGroupMemberTitleChangeNoticedPostContext : CqNotifyNoticeP /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 新荣誉 /// - public string NewTitle { get; set; } = string.Empty; + public string NewTitle { get; internal set; } = string.Empty; internal override object? QuickOperationModel => null; diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs index 873d131..76571cd 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs @@ -1,5 +1,5 @@ using EleCho.GoCqHttpSdk; - +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -7,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群消息上报上下文 /// - public record class CqGroupMessagePostContext : CqMessagePostContext + public record class CqGroupMessagePostContext : CqMessagePostContext, IGroupPostContext { /// /// 消息类型: 群 @@ -17,17 +17,12 @@ public record class CqGroupMessagePostContext : CqMessagePostContext /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 匿名对象 /// - public CqAnonymousInfomation? Anonymous { get; set; } - - /// - /// 发送者 - /// - public CqGroupMessageSender Sender { get; set; } = new CqGroupMessageSender(); + public CqAnonymousInfomation? Anonymous { get; internal set; } internal CqGroupMessagePostContext() { } @@ -47,7 +42,6 @@ internal override void ReadModel(CqPostModel model) GroupId = msgModel.group_id; Anonymous = msgModel.anonymous == null ? null : new CqAnonymousInfomation(msgModel.anonymous); - Sender = new CqGroupMessageSender(msgModel.sender); } } } \ No newline at end of file diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupMessageRecalledPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMessageRecalledPostContext.cs index bfb8b78..237f3e6 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMessageRecalledPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMessageRecalledPostContext.cs @@ -1,4 +1,5 @@  +using EleCho.GoCqHttpSdk.Post.Interface; using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post @@ -6,7 +7,7 @@ namespace EleCho.GoCqHttpSdk.Post /// /// 群消息撤回上报上下文 /// - public record class CqGroupMessageRecalledPostContext : CqNoticePostContext + public record class CqGroupMessageRecalledPostContext : CqNoticePostContext, IGroupPostContext { /// /// 通知类型 @@ -16,22 +17,22 @@ public record class CqGroupMessageRecalledPostContext : CqNoticePostContext /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 操作者 QQ /// - public long OperatorId { get; set; } + public long OperatorId { get; internal set; } /// /// 消息 ID /// - public long MessageId { get; set; } + public long MessageId { get; internal set; } internal CqGroupMessageRecalledPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupRequestPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupRequestPostContext.cs index f63c8a1..45648ed 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupRequestPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupRequestPostContext.cs @@ -1,11 +1,12 @@ -using EleCho.GoCqHttpSdk.Post.Model; +using EleCho.GoCqHttpSdk.Post.Interface; +using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post { /// /// 加群请求上报上下文 /// - public record class CqGroupRequestPostContext : CqRequestPostContext + public record class CqGroupRequestPostContext : CqRequestPostContext, IGroupPostContext { /// /// 请求类型: 群 @@ -17,27 +18,27 @@ internal CqGroupRequestPostContext() { } /// /// 群请求类型 /// - public CqGroupRequestType GroupRequestType { get; set; } + public CqGroupRequestType GroupRequestType { get; internal set; } /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 验证消息 /// - public string Comment { get; set; } = string.Empty; + public string Comment { get; internal set; } = string.Empty; /// /// 加群标志 (用来处理加群请求) /// - public string Flag { get; set; } = string.Empty; + public string Flag { get; internal set; } = string.Empty; /// /// 快速操作 diff --git a/src/EleCho.GoCqHttpSdk/Post/CqGroupSelfMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupSelfMessagePostContext.cs index 2abc453..70ff9bd 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupSelfMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupSelfMessagePostContext.cs @@ -1,11 +1,12 @@ -using EleCho.GoCqHttpSdk.Post.Model; +using EleCho.GoCqHttpSdk.Post.Interface; +using EleCho.GoCqHttpSdk.Post.Model; namespace EleCho.GoCqHttpSdk.Post { /// /// 群消息上报上下文 /// - public record class CqGroupSelfMessagePostContext : CqSelfMessagePostContext + public record class CqGroupSelfMessagePostContext : CqSelfMessagePostContext, IGroupPostContext { /// /// 消息类型: 群 @@ -15,17 +16,17 @@ public record class CqGroupSelfMessagePostContext : CqSelfMessagePostContext /// /// 群号 /// - public long GroupId { get; set; } + public long GroupId { get; internal set; } /// /// 匿名对象 /// - public CqAnonymousInfomation? Anonymous { get; set; } + public CqAnonymousInfomation? Anonymous { get; internal set; } /// /// 发送者 /// - public CqGroupMessageSender Sender { get; set; } = new CqGroupMessageSender(); + public CqGroupMessageSender Sender { get; internal set; } = new CqGroupMessageSender(); internal CqGroupSelfMessagePostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqHeartbeatPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqHeartbeatPostContext.cs index 4a59566..e195a38 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqHeartbeatPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqHeartbeatPostContext.cs @@ -17,12 +17,12 @@ public record class CqHeartbeatPostContext : CqMetaEventPostContext /// /// 状态 /// - public CqStatus Status { get; set; } = new CqStatus(); + public CqStatus Status { get; internal set; } = new CqStatus(); /// /// 间隔 /// - public TimeSpan Interval { get; set; } + public TimeSpan Interval { get; internal set; } internal CqHeartbeatPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqLifecyclePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqLifecyclePostContext.cs index 62b526d..5edd7c8 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqLifecyclePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqLifecyclePostContext.cs @@ -16,7 +16,7 @@ public record class CqLifecyclePostContext : CqMetaEventPostContext /// /// 生命周期类型 /// - public CqLifecycleType LifecycleType { get; set; } + public CqLifecycleType LifecycleType { get; internal set; } internal CqLifecyclePostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqOfflineFileUploadedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqOfflineFileUploadedPostContext.cs index 1ef4285..4137d17 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqOfflineFileUploadedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqOfflineFileUploadedPostContext.cs @@ -17,12 +17,12 @@ public record class CqOfflineFileUploadedPostContext : CqNoticePostContext /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 离线文件 /// - public CqOfflineFile File { get; set; } = new CqOfflineFile(); + public CqOfflineFile File { get; internal set; } = new CqOfflineFile(); internal CqOfflineFileUploadedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqPokeNoticedPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqPokeNoticedPostContext.cs index f0a2e3e..4af21e3 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqPokeNoticedPostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqPokeNoticedPostContext.cs @@ -16,22 +16,22 @@ public record class CqPokedPostContext : CqNotifyNoticePostContext /// /// 群号 /// - public long? GroupId { get; set; } + public long? GroupId { get; internal set; } /// /// 用户 QQ /// - public long UserId { get; set; } + public long UserId { get; internal set; } /// /// 发送者 QQ /// - public long SenderId { get; set; } + public long SenderId { get; internal set; } /// /// 目标 QQ /// - public long TargetId { get; set; } + public long TargetId { get; internal set; } internal CqPokedPostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs index a65e945..75bf868 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs @@ -19,17 +19,12 @@ public partial record class CqPrivateMessagePostContext : CqMessagePostContext /// /// 消息 /// - public CqPrivateMessageType PrivateMessageType { get; set; } + public CqPrivateMessageType PrivateMessageType { get; internal set; } /// /// 临时会话来源 /// - public CqTempSource TempSource { get; set; } - - /// - /// 发送者 - /// - public CqMessageSender Sender { get; set; } = new CqMessageSender(); + public CqTempSource TempSource { get; internal set; } internal CqPrivateMessagePostContext() { } @@ -49,7 +44,6 @@ internal override void ReadModel(CqPostModel model) PrivateMessageType = CqEnum.GetPrivateMessageType(msgModel.sub_type); TempSource = (CqTempSource)msgModel.temp_source; - Sender = new CqMessageSender(msgModel.sender); } } } \ No newline at end of file diff --git a/src/EleCho.GoCqHttpSdk/Post/CqPrivateSelfMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqPrivateSelfMessagePostContext.cs index 8c0593c..349ba5e 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqPrivateSelfMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqPrivateSelfMessagePostContext.cs @@ -15,17 +15,17 @@ public partial record class CqPrivateSelfMessagePostContext : CqSelfMessagePostC /// /// 消息 /// - public CqPrivateMessageType PrivateMessageType { get; set; } + public CqPrivateMessageType PrivateMessageType { get; internal set; } /// /// 临时会话来源 /// - public CqTempSource TempSource { get; set; } + public CqTempSource TempSource { get; internal set; } /// /// 发送者 /// - public CqMessageSender Sender { get; set; } = new CqMessageSender(); + public CqMessageSender Sender { get; internal set; } = new CqMessageSender(); internal CqPrivateSelfMessagePostContext() { } diff --git a/src/EleCho.GoCqHttpSdk/Post/Interface/IGroupPostContext.cs b/src/EleCho.GoCqHttpSdk/Post/Interface/IGroupPostContext.cs new file mode 100644 index 0000000..c54b0f4 --- /dev/null +++ b/src/EleCho.GoCqHttpSdk/Post/Interface/IGroupPostContext.cs @@ -0,0 +1,13 @@ +namespace EleCho.GoCqHttpSdk.Post.Interface +{ + /// + /// 群聊上报标记(其实就是能读GroupId + /// + public interface IGroupPostContext + { + /// + /// 群号 + /// + public long GroupId { get; } + } +} diff --git a/src/EleCho.GoCqHttpSdk/Post/Model/Base/CqMessagePostMovel.cs b/src/EleCho.GoCqHttpSdk/Post/Model/Base/CqMessagePostModel.cs similarity index 87% rename from src/EleCho.GoCqHttpSdk/Post/Model/Base/CqMessagePostMovel.cs rename to src/EleCho.GoCqHttpSdk/Post/Model/Base/CqMessagePostModel.cs index dd25a46..60be26c 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Model/Base/CqMessagePostMovel.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Model/Base/CqMessagePostModel.cs @@ -1,6 +1,7 @@ #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. #pragma warning disable IDE1006 // Naming Styles +using EleCho.GoCqHttpSdk.DataStructure.Model; using EleCho.GoCqHttpSdk.Message.DataModel; namespace EleCho.GoCqHttpSdk.Post.Model @@ -16,5 +17,6 @@ internal abstract class CqMessagePostModel : CqPostModel public CqMsgModel[] message { get; set; } public string raw_message { get; set; } public int font { get; set; } + public CqMessageSenderModel sender { get; set; } } } \ No newline at end of file diff --git a/src/EleCho.GoCqHttpSdk/Post/Model/CqGroupMessagePostModel.cs b/src/EleCho.GoCqHttpSdk/Post/Model/CqGroupMessagePostModel.cs index c5202df..adc76e6 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Model/CqGroupMessagePostModel.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Model/CqGroupMessagePostModel.cs @@ -11,6 +11,5 @@ internal class CqGroupMessagePostModel : CqMessagePostModel public long group_id { get; set; } public CqAnonymousInformationModel? anonymous { get; set; } - public CqGroupMessageSenderModel sender { get; set; } } } \ No newline at end of file diff --git a/src/EleCho.GoCqHttpSdk/Post/Model/CqNoticeEssencePostModel.cs b/src/EleCho.GoCqHttpSdk/Post/Model/CqNoticeEssencePostModel.cs index a705f16..8388302 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Model/CqNoticeEssencePostModel.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Model/CqNoticeEssencePostModel.cs @@ -17,5 +17,6 @@ internal class CqNoticeEssencePostModel : CqNoticePostModel public long sender_id { get; set; } public long operator_id { get; set; } public long message_id { get; set; } + public long group_id { get; set; } } } \ No newline at end of file diff --git a/src/EleCho.GoCqHttpSdk/Post/Model/CqPrivateMessagePostModel.cs b/src/EleCho.GoCqHttpSdk/Post/Model/CqPrivateMessagePostModel.cs index 6dc8d3f..d09aa14 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Model/CqPrivateMessagePostModel.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Model/CqPrivateMessagePostModel.cs @@ -13,6 +13,5 @@ internal class CqPrivateMessagePostModel : CqMessagePostModel /// /// public int temp_source { get; set; } - public CqMessageSenderModel sender { get; set; } } } \ No newline at end of file