Skip to content

Commit

Permalink
merge: pull request #52 from gdr2333/master
Browse files Browse the repository at this point in the history
新接口 CqNoticeEssencePostContext.GroupId和一些其他的东西
  • Loading branch information
SlimeNull authored Mar 31, 2024
2 parents fe251da + a4b5402 commit 935a667
Show file tree
Hide file tree
Showing 35 changed files with 141 additions and 119 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;net7.0;netstandard2.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>1.0.7</Version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;net7.0;netstandard2.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>1.0.6</Version>
Expand Down
8 changes: 2 additions & 6 deletions src/EleCho.GoCqHttpSdk/EleCho.GoCqHttpSdk.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;net7.0;netstandard2.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Authors>SlimeNull</Authors>
Expand Down Expand Up @@ -30,11 +30,7 @@
<None Remove="Temp\**" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<PackageReference Include="System.Net.Http" Version="*" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net462' Or '$(TargetFramework)'=='netstandard2.0' Or '$(TargetFramework)'=='netcoreapp3.1'">
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="*" />
</ItemGroup>

Expand Down
17 changes: 12 additions & 5 deletions src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,33 @@ public abstract record class CqMessagePostContext : CqPostContext
/// <summary>
/// 消息 ID
/// </summary>
public long MessageId { get; set; }
public long MessageId { get; internal set; }

/// <summary>
/// 用户 ID
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

/// <summary>
/// 发送者
/// </summary>
//对我没初始化但这是个abstract class并且派生类型都初始化了这个所以没问题...吧... -by gdr2333
public CqMessageSender Sender { get; internal set; } = new CqMessageSender();

/// <summary>
/// 消息实例
/// </summary>
public CqMessage Message { get; set; } = new CqMessage(0);
public CqMessage Message { get; internal set; } = new CqMessage(0);

/// <summary>
/// 原始消息 (CQ 码)
/// </summary>
public string RawMessage { get; set; } = string.Empty;
public string RawMessage { get; internal set; } = string.Empty;

/// <summary>
/// 字体
/// </summary>
public int Font { get; set; }
public int Font { get; internal set; }

internal override void ReadModel(CqPostModel model)
{
Expand All @@ -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);
}
}
}
4 changes: 2 additions & 2 deletions src/EleCho.GoCqHttpSdk/Post/Base/CqPostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ internal CqPostContext()
/// <summary>
/// 机器人 QQ ID
/// </summary>
public long SelfId { get; set; }
public long SelfId { get; internal set; }

/// <summary>
/// 上报时间
/// </summary>
public DateTime Time { get; set; }
public DateTime Time { get; internal set; }

internal abstract object? QuickOperationModel { get; }

Expand Down
10 changes: 5 additions & 5 deletions src/EleCho.GoCqHttpSdk/Post/Base/CqSelfMessagePostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ public abstract record class CqSelfMessagePostContext : CqPostContext
/// <summary>
/// 消息 ID
/// </summary>
public long MessageId { get; set; }
public long MessageId { get; internal set; }

/// <summary>
/// 用户 ID
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

/// <summary>
/// 消息实例
/// </summary>
public CqMessage Message { get; set; } = new CqMessage(0);
public CqMessage Message { get; internal set; } = new CqMessage(0);

/// <summary>
/// 原始消息 (CQ 码)
/// </summary>
public string RawMessage { get; set; } = string.Empty;
public string RawMessage { get; internal set; } = string.Empty;

/// <summary>
/// 字体
/// </summary>
public int Font { get; set; }
public int Font { get; internal set; }

internal override void ReadModel(CqPostModel model)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ internal CqClientStatusChangedPostContext() { }
/// <summary>
/// 是否在线
/// </summary>
public bool IsOnline { get; set; }
public bool IsOnline { get; internal set; }

/// <summary>
/// 客户端
/// </summary>
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)
Expand Down
2 changes: 1 addition & 1 deletion src/EleCho.GoCqHttpSdk/Post/CqFriendAddedPostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public record class CqFriendAddedPostContext : CqNoticePostContext
/// <summary>
/// 用户 QQ
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

internal CqFriendAddedPostContext() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public record class CqFriendMessageRecalledPostContext : CqNoticePostContext
/// <summary>
/// 用户 QQ
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

/// <summary>
/// 消息 ID
/// </summary>
public long MessageId { get; set; }
public long MessageId { get; internal set; }

internal CqFriendMessageRecalledPostContext() { }

Expand Down
6 changes: 3 additions & 3 deletions src/EleCho.GoCqHttpSdk/Post/CqFriendRequestPostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ public record class CqFriendRequestPostContext : CqRequestPostContext
/// <summary>
/// 用户 QQ
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

/// <summary>
/// 验证消息
/// </summary>
public string Comment { get; set; } = string.Empty;
public string Comment { get; internal set; } = string.Empty;

/// <summary>
/// 请求标志 (用来处理请求)
/// </summary>
public string Flag { get; set; } = string.Empty;
public string Flag { get; internal set; } = string.Empty;

internal CqFriendRequestPostContext() { }

Expand Down
9 changes: 5 additions & 4 deletions src/EleCho.GoCqHttpSdk/Post/CqGroupAdminChangedPostContext.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

using EleCho.GoCqHttpSdk.Post.Interface;
using EleCho.GoCqHttpSdk.Post.Model;

namespace EleCho.GoCqHttpSdk.Post
{
/// <summary>
/// 群管理员变更上报上下文
/// </summary>
public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext
public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext, IGroupPostContext
{
/// <summary>
/// 通知类型: 群管理员
Expand All @@ -16,17 +17,17 @@ public record class CqGroupAdministratorChangedPostContext : CqNoticePostContext
/// <summary>
/// 变更类型
/// </summary>
public CqGroupAdminChangeType ChangeType { get; set; }
public CqGroupAdminChangeType ChangeType { get; internal set; }

/// <summary>
/// 群号
/// </summary>
public long GroupId { get; set; }
public long GroupId { get; internal set; }

/// <summary>
/// 用户 QQ
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

internal CqGroupAdministratorChangedPostContext() { }

Expand Down
17 changes: 12 additions & 5 deletions src/EleCho.GoCqHttpSdk/Post/CqGroupEssenceChangedPostContext.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

using EleCho.GoCqHttpSdk.Post.Interface;
using EleCho.GoCqHttpSdk.Post.Model;

namespace EleCho.GoCqHttpSdk.Post
{
/// <summary>
/// 群精华消息变更上报上下文
/// </summary>
public record class CqGroupEssenceChangedPostContext : CqNoticePostContext
public record class CqGroupEssenceChangedPostContext : CqNoticePostContext, IGroupPostContext
{
internal CqGroupEssenceChangedPostContext() { }

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

/// <summary>
/// 消息发送者 QQ
/// </summary>
public long SenderId { get; set; }
public long SenderId { get; internal set; }

/// <summary>
/// 操作者 QQ
/// </summary>
public long OperatorId { get; set; }
public long OperatorId { get; internal set; }

/// <summary>
/// 消息 ID
/// </summary>
public long MessageId { get; set; }
public long MessageId { get; internal set; }

/// <summary>
/// 群号
/// </summary>
public long GroupId { get; internal set; }

internal override object? QuickOperationModel => null;
internal override void ReadModel(CqPostModel model)
Expand All @@ -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;
}
}
}
10 changes: 5 additions & 5 deletions src/EleCho.GoCqHttpSdk/Post/CqGroupFileUploadedPostContext.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using EleCho.GoCqHttpSdk;

using EleCho.GoCqHttpSdk.Post.Interface;
using EleCho.GoCqHttpSdk.Post.Model;

namespace EleCho.GoCqHttpSdk.Post
{
/// <summary>
/// 群文件上传上报上下文
/// </summary>
public record class CqGroupFileUploadedPostContext : CqNoticePostContext
public record class CqGroupFileUploadedPostContext : CqNoticePostContext, IGroupPostContext
{
/// <summary>
/// 通知类型: 群文件上传
Expand All @@ -17,17 +17,17 @@ public record class CqGroupFileUploadedPostContext : CqNoticePostContext
/// <summary>
/// 群号
/// </summary>
public long GroupId { get; set; }
public long GroupId { get; internal set; }

/// <summary>
/// 用户 QQ
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

/// <summary>
/// 群文件
/// </summary>
public CqGroupUploadedFile File { get; set; } = new CqGroupUploadedFile();
public CqGroupUploadedFile File { get; internal set; } = new CqGroupUploadedFile();

internal CqGroupFileUploadedPostContext() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ public record class CqGroupLuckyKingNoticedPostContext : CqNotifyNoticePostConte
/// <summary>
/// 群号
/// </summary>
public long GroupId { get; set; }
public long GroupId { get; internal set; }

/// <summary>
/// 用户 QQ (红包发送者 QQ)
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

/// <summary>
/// 目标 QQ (运气王 QQ)
/// </summary>
public long TargetId { get; set; }
public long TargetId { get; internal set; }


internal CqGroupLuckyKingNoticedPostContext() { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

using EleCho.GoCqHttpSdk.Post.Interface;
using EleCho.GoCqHttpSdk.Post.Model;
using System;

Expand All @@ -7,7 +8,7 @@ namespace EleCho.GoCqHttpSdk.Post
/// <summary>
/// 群成员禁言状态变更上报上下文
/// </summary>
public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext
public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext, IGroupPostContext
{
/// <summary>
/// 通知类型: 群禁言
Expand All @@ -17,27 +18,27 @@ public record class CqGroupMemberBanChangedPostContext : CqNoticePostContext
/// <summary>
/// 变更类型
/// </summary>
public CqGroupBanChangeType ChangeType { get; set; }
public CqGroupBanChangeType ChangeType { get; internal set; }

/// <summary>
/// 群号
/// </summary>
public long GroupId { get; set; }
public long GroupId { get; internal set; }

/// <summary>
/// 用户 QQ
/// </summary>
public long UserId { get; set; }
public long UserId { get; internal set; }

/// <summary>
/// 操作者 QQ
/// </summary>
public long OperatorId { get; set; }
public long OperatorId { get; internal set; }

/// <summary>
/// 时长 (如果为 0 则是取消禁言)
/// </summary>
public TimeSpan Duration { get; set; }
public TimeSpan Duration { get; internal set; }

internal CqGroupMemberBanChangedPostContext() { }

Expand Down
Loading

0 comments on commit 935a667

Please sign in to comment.