From a50c139470c6bad1ce20d59b0f40206ed4d0470d Mon Sep 17 00:00:00 2001 From: gdr2333 Date: Fri, 29 Mar 2024 11:53:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9A=20EleCho.GoCqHttpSdk.Post.Interface.IGroupPostContext?= =?UTF-8?q?=EF=BC=9A=E6=89=80=E6=9C=89=E7=BE=A4=E8=81=8A=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=B6=88=E6=81=AF=EF=BC=88=E9=99=A4=E4=BA=86=E6=88=B3=E4=B8=80?= =?UTF-8?q?=E6=88=B3=EF=BC=89=E9=83=BD=E5=AE=9E=E7=8E=B0=E4=BA=86=E8=AF=A5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=8F=AF=E4=BB=A5=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E7=BE=A4=E5=8F=B7=20EleCho.GoCqHttpSdk.ICqActionAndPostSession?= =?UTF-8?q?=EF=BC=9A=E6=AD=A3=E5=90=91=E5=92=8C=E5=8F=8D=E5=90=91websocket?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E5=AE=9E=E7=8E=B0=E4=BA=86=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=85=B6=E5=AE=9E=E5=B0=B1=E6=98=AF?= =?UTF-8?q?ICqPostSession=E5=92=8CICqActionSession=20=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=EF=BC=9ACqNoticeEssencePostContext=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E5=AE=9E=E7=8E=B0=E4=BA=86GroupId=20=E8=A1=8C?= =?UTF-8?q?=E4=B8=BA=E5=8F=98=E6=9B=B4=EF=BC=9A=E5=87=A0=E4=B9=8E=E6=89=80?= =?UTF-8?q?=E6=9C=89=E4=B8=8A=E6=8A=A5=E6=B6=88=E6=81=AF=E7=9A=84=E6=88=90?= =?UTF-8?q?=E5=91=98=E7=9A=84set=E8=AE=BF=E9=97=AE=E5=99=A8=E9=83=BD?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BA=86internel=20set=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E4=BD=A0=E6=A0=B9=E6=9C=AC=E5=B0=B1=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E6=9B=B4=E6=94=B9=E8=BF=99=E4=BA=9B=E5=86=85=E5=AE=B9?= =?UTF-8?q?=20=E5=85=B6=E4=BB=96=EF=BC=9A=20=E5=B0=86.net=208.0=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=B0=E7=9B=AE=E6=A0=87=E6=A1=86=E6=9E=B6=20csproj?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E4=B8=80=E4=BA=9B=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EleCho.GoCqHttpSdk.CommandExecuting.csproj | 2 +- .../EleCho.GoCqHttpSdk.MessageMatching.csproj | 2 +- src/EleCho.GoCqHttpSdk/CqRWsSession.cs | 2 +- src/EleCho.GoCqHttpSdk/CqWsSession.cs | 2 +- .../EleCho.GoCqHttpSdk.csproj | 8 ++------ .../ICqActionAndPostSession.cs | 6 ++++++ .../Post/Base/CqMessagePostContext.cs | 16 +++++++++++----- .../Post/Base/CqPostContext.cs | 4 ++-- .../Post/Base/CqSelfMessagePostContext.cs | 10 +++++----- .../Post/CqClientStatusChangedPostContext.cs | 4 ++-- .../Post/CqFriendAddedPostContext.cs | 2 +- .../Post/CqFriendMessageRecalledPostContext.cs | 4 ++-- .../Post/CqFriendRequestPostContext.cs | 6 +++--- .../Post/CqGroupAdminChangedPostContext.cs | 9 +++++---- .../Post/CqGroupEssenceChangedPostContext.cs | 17 ++++++++++++----- .../Post/CqGroupFileUploadedPostContext.cs | 10 +++++----- .../Post/CqGroupLuckyKingNoticedPostContext.cs | 6 +++--- .../Post/CqGroupMemberBanChangedPostContext.cs | 13 +++++++------ .../Post/CqGroupMemberDecreasedPostContext.cs | 3 ++- .../CqGroupMemberHonorChangedPostContext.cs | 9 +++++---- .../Post/CqGroupMemberIncreasedPostContext.cs | 11 ++++++----- .../CqGroupMemberNicknameChangedPostContext.cs | 11 ++++++----- ...qGroupMemberTitleChangeNoticedPostContext.cs | 9 +++++---- .../Post/CqGroupMessagePostContext.cs | 13 ++++--------- .../Post/CqGroupMessageRecalledPostContext.cs | 11 ++++++----- .../Post/CqGroupRequestPostContext.cs | 15 ++++++++------- .../Post/CqGroupSelfMessagePostContext.cs | 11 ++++++----- .../Post/CqHeartbeatPostContext.cs | 4 ++-- .../Post/CqLifecyclePostContext.cs | 2 +- .../Post/CqOfflineFileUploadedPostContext.cs | 4 ++-- .../Post/CqPokeNoticedPostContext.cs | 8 ++++---- .../Post/CqPrivateMessagePostContext.cs | 9 ++------- .../Post/CqPrivateSelfMessagePostContext.cs | 6 +++--- .../Post/Interface/IGroupPostContext.cs | 13 +++++++++++++ .../Post/Model/CqNoticeEssencePostModel.cs | 1 + 35 files changed, 146 insertions(+), 117 deletions(-) create mode 100644 src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs create mode 100644 src/EleCho.GoCqHttpSdk/Post/Interface/IGroupPostContext.cs diff --git a/src/EleCho.GoCqHttpSdk.CommandExecuting/EleCho.GoCqHttpSdk.CommandExecuting.csproj b/src/EleCho.GoCqHttpSdk.CommandExecuting/EleCho.GoCqHttpSdk.CommandExecuting.csproj index 565f439..b55a588 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.7 diff --git a/src/EleCho.GoCqHttpSdk.MessageMatching/EleCho.GoCqHttpSdk.MessageMatching.csproj b/src/EleCho.GoCqHttpSdk.MessageMatching/EleCho.GoCqHttpSdk.MessageMatching.csproj index c14d905..f291041 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/CqRWsSession.cs b/src/EleCho.GoCqHttpSdk/CqRWsSession.cs index 0b7e8bc..1493190 100644 --- a/src/EleCho.GoCqHttpSdk/CqRWsSession.cs +++ b/src/EleCho.GoCqHttpSdk/CqRWsSession.cs @@ -13,7 +13,7 @@ namespace EleCho.GoCqHttpSdk /// /// 反向 WebSocket 会话 /// - public class CqRWsSession : CqSession, ICqActionSession, ICqPostSession, IDisposable + public class CqRWsSession : CqSession, ICqActionAndPostSession, ICqActionSession, ICqPostSession, IDisposable { private readonly Uri baseUri; private readonly int bufferSize; diff --git a/src/EleCho.GoCqHttpSdk/CqWsSession.cs b/src/EleCho.GoCqHttpSdk/CqWsSession.cs index 0f5ccda..eba0a20 100644 --- a/src/EleCho.GoCqHttpSdk/CqWsSession.cs +++ b/src/EleCho.GoCqHttpSdk/CqWsSession.cs @@ -19,7 +19,7 @@ namespace EleCho.GoCqHttpSdk /// 正向 WebSocket 会话 /// 可处理上报, 以及发送 Action /// - public class CqWsSession : CqSession, ICqPostSession, ICqActionSession, IDisposable + public class CqWsSession : CqSession, ICqActionAndPostSession, ICqPostSession, ICqActionSession, IDisposable { /// /// 基地址 diff --git a/src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj b/src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj index a52e0cf..eff7863 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/ICqActionAndPostSession.cs b/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs new file mode 100644 index 0000000..fff20aa --- /dev/null +++ b/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs @@ -0,0 +1,6 @@ +namespace EleCho.GoCqHttpSdk +{ + internal interface ICqActionAndPostSession : ICqPostSession, ICqActionSession + { + } +} diff --git a/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs index f57523e..8658fdf 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) { 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..82bc1c6 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() { } 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..9a84ade 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() { } 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/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 From 68741e0a3eab84fc0aaa0b73d24ef872684817e8 Mon Sep 17 00:00:00 2001 From: gdr2333 Date: Fri, 29 Mar 2024 16:08:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9C=89=E4=B8=AA=E5=82=BB=E5=AD=90?= =?UTF-8?q?=E5=86=99=E4=BA=86=E4=B8=80=E4=B8=AA=E5=86=85=E9=83=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=87=BA=E6=9D=A5=E6=88=91=E4=B8=8D=E8=AF=B4=E6=98=AF?= =?UTF-8?q?=E8=B0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs b/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs index fff20aa..0fa9962 100644 --- a/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs +++ b/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs @@ -1,6 +1,6 @@ namespace EleCho.GoCqHttpSdk { - internal interface ICqActionAndPostSession : ICqPostSession, ICqActionSession + public interface ICqActionAndPostSession : ICqPostSession, ICqActionSession { } } From d903cce7f38f5a07dda84cd3bc8187eb800b7e87 Mon Sep 17 00:00:00 2001 From: df1050 Date: Sat, 30 Mar 2024 13:51:33 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=86=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/EleCho.GoCqHttpSdk/CqRWsSession.cs | 2 +- src/EleCho.GoCqHttpSdk/CqWsSession.cs | 2 +- src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs diff --git a/src/EleCho.GoCqHttpSdk/CqRWsSession.cs b/src/EleCho.GoCqHttpSdk/CqRWsSession.cs index 1493190..0b7e8bc 100644 --- a/src/EleCho.GoCqHttpSdk/CqRWsSession.cs +++ b/src/EleCho.GoCqHttpSdk/CqRWsSession.cs @@ -13,7 +13,7 @@ namespace EleCho.GoCqHttpSdk /// /// 反向 WebSocket 会话 /// - public class CqRWsSession : CqSession, ICqActionAndPostSession, ICqActionSession, ICqPostSession, IDisposable + public class CqRWsSession : CqSession, ICqActionSession, ICqPostSession, IDisposable { private readonly Uri baseUri; private readonly int bufferSize; diff --git a/src/EleCho.GoCqHttpSdk/CqWsSession.cs b/src/EleCho.GoCqHttpSdk/CqWsSession.cs index eba0a20..0f5ccda 100644 --- a/src/EleCho.GoCqHttpSdk/CqWsSession.cs +++ b/src/EleCho.GoCqHttpSdk/CqWsSession.cs @@ -19,7 +19,7 @@ namespace EleCho.GoCqHttpSdk /// 正向 WebSocket 会话 /// 可处理上报, 以及发送 Action /// - public class CqWsSession : CqSession, ICqActionAndPostSession, ICqPostSession, ICqActionSession, IDisposable + public class CqWsSession : CqSession, ICqPostSession, ICqActionSession, IDisposable { /// /// 基地址 diff --git a/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs b/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs deleted file mode 100644 index 0fa9962..0000000 --- a/src/EleCho.GoCqHttpSdk/ICqActionAndPostSession.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace EleCho.GoCqHttpSdk -{ - public interface ICqActionAndPostSession : ICqPostSession, ICqActionSession - { - } -} From a4b5402947f0d4dce37d29adc87d1e5ebde9acc8 Mon Sep 17 00:00:00 2001 From: df1050 Date: Sat, 30 Mar 2024 14:04:22 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=BA=86CqMessagePostMod?= =?UTF-8?q?el=EF=BC=8C=E5=B0=86CqGroupMessagePostContext=E5=92=8CCqPrivate?= =?UTF-8?q?MessagePostContext=E7=9A=84sender=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E8=BD=AC=E7=A7=BB=E5=88=B0CqMessagePostConte?= =?UTF-8?q?xt,=E5=B9=B6=E9=A1=BA=E6=89=8B=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E9=94=99=E8=AF=AF=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs | 1 + src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs | 1 - src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs | 1 - .../Model/Base/{CqMessagePostMovel.cs => CqMessagePostModel.cs} | 2 ++ src/EleCho.GoCqHttpSdk/Post/Model/CqGroupMessagePostModel.cs | 1 - src/EleCho.GoCqHttpSdk/Post/Model/CqPrivateMessagePostModel.cs | 1 - 6 files changed, 3 insertions(+), 4 deletions(-) rename src/EleCho.GoCqHttpSdk/Post/Model/Base/{CqMessagePostMovel.cs => CqMessagePostModel.cs} (87%) diff --git a/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs index 8658fdf..0c13277 100644 --- a/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs @@ -66,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/CqGroupMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs index 82bc1c6..76571cd 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs @@ -42,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/CqPrivateMessagePostContext.cs b/src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs index 9a84ade..75bf868 100644 --- a/src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs +++ b/src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs @@ -44,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/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/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