Skip to content

Commit 9a052b7

Browse files
committed
2 parents 87e46b5 + 935a667 commit 9a052b7

35 files changed

+141
-119
lines changed

src/EleCho.GoCqHttpSdk.CommandExecuting/EleCho.GoCqHttpSdk.CommandExecuting.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net6.0;net7.0;netstandard2.0</TargetFrameworks>
55
<Nullable>enable</Nullable>
66
<LangVersion>latest</LangVersion>
77
<Version>1.0.8</Version>

src/EleCho.GoCqHttpSdk.MessageMatching/EleCho.GoCqHttpSdk.MessageMatching.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net6.0;net7.0;netstandard2.0</TargetFrameworks>
55
<Nullable>enable</Nullable>
66
<LangVersion>latest</LangVersion>
77
<Version>1.0.6</Version>

src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net6.0;net7.0;netstandard2.0</TargetFrameworks>
55
<Nullable>enable</Nullable>
66
<LangVersion>latest</LangVersion>
77
<Authors>SlimeNull</Authors>
@@ -30,11 +30,7 @@
3030
<None Remove="Temp\**" />
3131
</ItemGroup>
3232

33-
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
34-
<PackageReference Include="System.Net.Http" Version="*" />
35-
</ItemGroup>
36-
37-
<ItemGroup Condition="'$(TargetFramework)'=='net462' Or '$(TargetFramework)'=='netstandard2.0' Or '$(TargetFramework)'=='netcoreapp3.1'">
33+
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
3834
<PackageReference Include="System.Text.Json" Version="*" />
3935
</ItemGroup>
4036

src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs

+12-5
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,33 @@ public abstract record class CqMessagePostContext : CqPostContext
2626
/// <summary>
2727
/// 消息 ID
2828
/// </summary>
29-
public long MessageId { get; set; }
29+
public long MessageId { get; internal set; }
3030

3131
/// <summary>
3232
/// 用户 ID
3333
/// </summary>
34-
public long UserId { get; set; }
34+
public long UserId { get; internal set; }
35+
36+
/// <summary>
37+
/// 发送者
38+
/// </summary>
39+
//对我没初始化但这是个abstract class并且派生类型都初始化了这个所以没问题...吧... -by gdr2333
40+
public CqMessageSender Sender { get; internal set; } = new CqMessageSender();
3541

3642
/// <summary>
3743
/// 消息实例
3844
/// </summary>
39-
public CqMessage Message { get; set; } = new CqMessage(0);
45+
public CqMessage Message { get; internal set; } = new CqMessage(0);
4046

4147
/// <summary>
4248
/// 原始消息 (CQ 码)
4349
/// </summary>
44-
public string RawMessage { get; set; } = string.Empty;
50+
public string RawMessage { get; internal set; } = string.Empty;
4551

4652
/// <summary>
4753
/// 字体
4854
/// </summary>
49-
public int Font { get; set; }
55+
public int Font { get; internal set; }
5056

5157
internal override void ReadModel(CqPostModel model)
5258
{
@@ -60,6 +66,7 @@ internal override void ReadModel(CqPostModel model)
6066
Message = new CqMessage(msgModel.message.Select(CqMsg.FromModel));
6167
RawMessage = msgModel.raw_message;
6268
Font = msgModel.font;
69+
Sender = new CqMessageSender(msgModel.sender);
6370
}
6471
}
6572
}

src/EleCho.GoCqHttpSdk/Post/Base/CqPostContext.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ internal CqPostContext()
2929
/// <summary>
3030
/// 机器人 QQ ID
3131
/// </summary>
32-
public long SelfId { get; set; }
32+
public long SelfId { get; internal set; }
3333

3434
/// <summary>
3535
/// 上报时间
3636
/// </summary>
37-
public DateTime Time { get; set; }
37+
public DateTime Time { get; internal set; }
3838

3939
internal abstract object? QuickOperationModel { get; }
4040

src/EleCho.GoCqHttpSdk/Post/Base/CqSelfMessagePostContext.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ public abstract record class CqSelfMessagePostContext : CqPostContext
2222
/// <summary>
2323
/// 消息 ID
2424
/// </summary>
25-
public long MessageId { get; set; }
25+
public long MessageId { get; internal set; }
2626

2727
/// <summary>
2828
/// 用户 ID
2929
/// </summary>
30-
public long UserId { get; set; }
30+
public long UserId { get; internal set; }
3131

3232
/// <summary>
3333
/// 消息实例
3434
/// </summary>
35-
public CqMessage Message { get; set; } = new CqMessage(0);
35+
public CqMessage Message { get; internal set; } = new CqMessage(0);
3636

3737
/// <summary>
3838
/// 原始消息 (CQ 码)
3939
/// </summary>
40-
public string RawMessage { get; set; } = string.Empty;
40+
public string RawMessage { get; internal set; } = string.Empty;
4141

4242
/// <summary>
4343
/// 字体
4444
/// </summary>
45-
public int Font { get; set; }
45+
public int Font { get; internal set; }
4646

4747
internal override void ReadModel(CqPostModel model)
4848
{

src/EleCho.GoCqHttpSdk/Post/CqClientStatusChangedPostContext.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ internal CqClientStatusChangedPostContext() { }
1919
/// <summary>
2020
/// 是否在线
2121
/// </summary>
22-
public bool IsOnline { get; set; }
22+
public bool IsOnline { get; internal set; }
2323

2424
/// <summary>
2525
/// 客户端
2626
/// </summary>
27-
public CqDevice Client { get; set; } = new CqDevice();
27+
public CqDevice Client { get; internal set; } = new CqDevice();
2828

2929
internal override object? QuickOperationModel => null;
3030
internal override void ReadModel(CqPostModel model)

src/EleCho.GoCqHttpSdk/Post/CqFriendAddedPostContext.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public record class CqFriendAddedPostContext : CqNoticePostContext
1616
/// <summary>
1717
/// 用户 QQ
1818
/// </summary>
19-
public long UserId { get; set; }
19+
public long UserId { get; internal set; }
2020

2121
internal CqFriendAddedPostContext() { }
2222

src/EleCho.GoCqHttpSdk/Post/CqFriendMessageRecalledPostContext.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public record class CqFriendMessageRecalledPostContext : CqNoticePostContext
1616
/// <summary>
1717
/// 用户 QQ
1818
/// </summary>
19-
public long UserId { get; set; }
19+
public long UserId { get; internal set; }
2020

2121
/// <summary>
2222
/// 消息 ID
2323
/// </summary>
24-
public long MessageId { get; set; }
24+
public long MessageId { get; internal set; }
2525

2626
internal CqFriendMessageRecalledPostContext() { }
2727

src/EleCho.GoCqHttpSdk/Post/CqFriendRequestPostContext.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ public record class CqFriendRequestPostContext : CqRequestPostContext
1717
/// <summary>
1818
/// 用户 QQ
1919
/// </summary>
20-
public long UserId { get; set; }
20+
public long UserId { get; internal set; }
2121

2222
/// <summary>
2323
/// 验证消息
2424
/// </summary>
25-
public string Comment { get; set; } = string.Empty;
25+
public string Comment { get; internal set; } = string.Empty;
2626

2727
/// <summary>
2828
/// 请求标志 (用来处理请求)
2929
/// </summary>
30-
public string Flag { get; set; } = string.Empty;
30+
public string Flag { get; internal set; } = string.Empty;
3131

3232
internal CqFriendRequestPostContext() { }
3333

src/EleCho.GoCqHttpSdk/Post/CqGroupAdminChangedPostContext.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11

2+
using EleCho.GoCqHttpSdk.Post.Interface;
23
using EleCho.GoCqHttpSdk.Post.Model;
34

45
namespace EleCho.GoCqHttpSdk.Post
56
{
67
/// <summary>
78
/// 群管理员变更上报上下文
89
/// </summary>
9-
public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext
10+
public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext, IGroupPostContext
1011
{
1112
/// <summary>
1213
/// 通知类型: 群管理员
@@ -16,17 +17,17 @@ public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext
1617
/// <summary>
1718
/// 变更类型
1819
/// </summary>
19-
public CqGroupAdminChangeType ChangeType { get; set; }
20+
public CqGroupAdminChangeType ChangeType { get; internal set; }
2021

2122
/// <summary>
2223
/// 群号
2324
/// </summary>
24-
public long GroupId { get; set; }
25+
public long GroupId { get; internal set; }
2526

2627
/// <summary>
2728
/// 用户 QQ
2829
/// </summary>
29-
public long UserId { get; set; }
30+
public long UserId { get; internal set; }
3031

3132
internal CqGroupAdministratorChangedPostContext() { }
3233

src/EleCho.GoCqHttpSdk/Post/CqGroupEssenceChangedPostContext.cs

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11

2+
using EleCho.GoCqHttpSdk.Post.Interface;
23
using EleCho.GoCqHttpSdk.Post.Model;
34

45
namespace EleCho.GoCqHttpSdk.Post
56
{
67
/// <summary>
78
/// 群精华消息变更上报上下文
89
/// </summary>
9-
public record class CqGroupEssenceChangedPostContext : CqNoticePostContext
10+
public record class CqGroupEssenceChangedPostContext : CqNoticePostContext, IGroupPostContext
1011
{
1112
internal CqGroupEssenceChangedPostContext() { }
1213

@@ -18,22 +19,27 @@ internal CqGroupEssenceChangedPostContext() { }
1819
/// <summary>
1920
/// 变更类型
2021
/// </summary>
21-
public CqEssenceChangeType ChangeType { get; set; }
22+
public CqEssenceChangeType ChangeType { get; internal set; }
2223

2324
/// <summary>
2425
/// 消息发送者 QQ
2526
/// </summary>
26-
public long SenderId { get; set; }
27+
public long SenderId { get; internal set; }
2728

2829
/// <summary>
2930
/// 操作者 QQ
3031
/// </summary>
31-
public long OperatorId { get; set; }
32+
public long OperatorId { get; internal set; }
3233

3334
/// <summary>
3435
/// 消息 ID
3536
/// </summary>
36-
public long MessageId { get; set; }
37+
public long MessageId { get; internal set; }
38+
39+
/// <summary>
40+
/// 群号
41+
/// </summary>
42+
public long GroupId { get; internal set; }
3743

3844
internal override object? QuickOperationModel => null;
3945
internal override void ReadModel(CqPostModel model)
@@ -47,6 +53,7 @@ internal override void ReadModel(CqPostModel model)
4753
SenderId = noticeModel.sender_id;
4854
OperatorId = noticeModel.operator_id;
4955
MessageId = noticeModel.message_id;
56+
GroupId = noticeModel.group_id;
5057
}
5158
}
5259
}

src/EleCho.GoCqHttpSdk/Post/CqGroupFileUploadedPostContext.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using EleCho.GoCqHttpSdk;
2-
2+
using EleCho.GoCqHttpSdk.Post.Interface;
33
using EleCho.GoCqHttpSdk.Post.Model;
44

55
namespace EleCho.GoCqHttpSdk.Post
66
{
77
/// <summary>
88
/// 群文件上传上报上下文
99
/// </summary>
10-
public record class CqGroupFileUploadedPostContext : CqNoticePostContext
10+
public record class CqGroupFileUploadedPostContext : CqNoticePostContext, IGroupPostContext
1111
{
1212
/// <summary>
1313
/// 通知类型: 群文件上传
@@ -17,17 +17,17 @@ public record class CqGroupFileUploadedPostContext : CqNoticePostContext
1717
/// <summary>
1818
/// 群号
1919
/// </summary>
20-
public long GroupId { get; set; }
20+
public long GroupId { get; internal set; }
2121

2222
/// <summary>
2323
/// 用户 QQ
2424
/// </summary>
25-
public long UserId { get; set; }
25+
public long UserId { get; internal set; }
2626

2727
/// <summary>
2828
/// 群文件
2929
/// </summary>
30-
public CqGroupUploadedFile File { get; set; } = new CqGroupUploadedFile();
30+
public CqGroupUploadedFile File { get; internal set; } = new CqGroupUploadedFile();
3131

3232
internal CqGroupFileUploadedPostContext() { }
3333

src/EleCho.GoCqHttpSdk/Post/CqGroupLuckyKingNoticedPostContext.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ public record class CqGroupLuckyKingNoticedPostContext : CqNotifyNoticePostConte
1616
/// <summary>
1717
/// 群号
1818
/// </summary>
19-
public long GroupId { get; set; }
19+
public long GroupId { get; internal set; }
2020

2121
/// <summary>
2222
/// 用户 QQ (红包发送者 QQ)
2323
/// </summary>
24-
public long UserId { get; set; }
24+
public long UserId { get; internal set; }
2525

2626
/// <summary>
2727
/// 目标 QQ (运气王 QQ)
2828
/// </summary>
29-
public long TargetId { get; set; }
29+
public long TargetId { get; internal set; }
3030

3131

3232
internal CqGroupLuckyKingNoticedPostContext() { }

src/EleCho.GoCqHttpSdk/Post/CqGroupMemberBanChangedPostContext.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
using EleCho.GoCqHttpSdk.Post.Interface;
23
using EleCho.GoCqHttpSdk.Post.Model;
34
using System;
45

@@ -7,7 +8,7 @@ namespace EleCho.GoCqHttpSdk.Post
78
/// <summary>
89
/// 群成员禁言状态变更上报上下文
910
/// </summary>
10-
public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext
11+
public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext, IGroupPostContext
1112
{
1213
/// <summary>
1314
/// 通知类型: 群禁言
@@ -17,27 +18,27 @@ public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext
1718
/// <summary>
1819
/// 变更类型
1920
/// </summary>
20-
public CqGroupBanChangeType ChangeType { get; set; }
21+
public CqGroupBanChangeType ChangeType { get; internal set; }
2122

2223
/// <summary>
2324
/// 群号
2425
/// </summary>
25-
public long GroupId { get; set; }
26+
public long GroupId { get; internal set; }
2627

2728
/// <summary>
2829
/// 用户 QQ
2930
/// </summary>
30-
public long UserId { get; set; }
31+
public long UserId { get; internal set; }
3132

3233
/// <summary>
3334
/// 操作者 QQ
3435
/// </summary>
35-
public long OperatorId { get; set; }
36+
public long OperatorId { get; internal set; }
3637

3738
/// <summary>
3839
/// 时长 (如果为 0 则是取消禁言)
3940
/// </summary>
40-
public TimeSpan Duration { get; set; }
41+
public TimeSpan Duration { get; internal set; }
4142

4243
internal CqGroupMemberBanChangedPostContext() { }
4344

0 commit comments

Comments
 (0)