Skip to content

Commit

Permalink
Merge pull request #53 from gdr2333/master
Browse files Browse the repository at this point in the history
对不起,我来收拾烂摊子了
  • Loading branch information
SlimeNull authored Aug 12, 2024
2 parents 6be84fa + 56fe199 commit 4be5675
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
7 changes: 0 additions & 7 deletions src/EleCho.GoCqHttpSdk/Post/Base/CqMessagePostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ public abstract record class CqMessagePostContext : CqPostContext
/// </summary>
public long UserId { get; internal set; }

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

/// <summary>
/// 消息实例
/// </summary>
Expand Down Expand Up @@ -66,7 +60,6 @@ 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);
}
}
}
7 changes: 6 additions & 1 deletion src/EleCho.GoCqHttpSdk/Post/CqGroupMessagePostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public record class CqGroupMessagePostContext : CqMessagePostContext, IGroupPost
/// 匿名对象
/// </summary>
public CqAnonymousInfomation? Anonymous { get; internal set; }

/// <summary>
/// 发送者
/// </summary>
public CqGroupMessageSender Sender { get; internal set; } = new CqGroupMessageSender();

internal CqGroupMessagePostContext() { }

/// <summary>
Expand All @@ -42,6 +46,7 @@ internal override void ReadModel(CqPostModel model)

GroupId = msgModel.group_id;
Anonymous = msgModel.anonymous == null ? null : new CqAnonymousInfomation(msgModel.anonymous);
Sender = new CqGroupMessageSender(msgModel.sender);
}
}
}
5 changes: 5 additions & 0 deletions src/EleCho.GoCqHttpSdk/Post/CqPrivateMessagePostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public partial record class CqPrivateMessagePostContext : CqMessagePostContext
/// 临时会话来源
/// </summary>
public CqTempSource TempSource { get; internal set; }
/// <summary>
/// 发送者
/// </summary>
public CqMessageSender Sender { get; internal set; } = new CqMessageSender();

internal CqPrivateMessagePostContext() { }

Expand All @@ -44,6 +48,7 @@ internal override void ReadModel(CqPostModel model)

PrivateMessageType = CqEnum.GetPrivateMessageType(msgModel.sub_type);
TempSource = (CqTempSource)msgModel.temp_source;
Sender = new CqMessageSender(msgModel.sender);
}
}
}
2 changes: 0 additions & 2 deletions src/EleCho.GoCqHttpSdk/Post/Model/Base/CqMessagePostModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#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
Expand All @@ -17,6 +16,5 @@ 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; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ internal class CqGroupMessagePostModel : CqMessagePostModel

public long group_id { get; set; }
public CqAnonymousInformationModel? anonymous { get; set; }
public CqGroupMessageSenderModel sender { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ internal class CqPrivateMessagePostModel : CqMessagePostModel
/// <see cref="CqTempSource"/>
/// </summary>
public int temp_source { get; set; }
public CqMessageSenderModel sender { get; set; }
}
}

0 comments on commit 4be5675

Please sign in to comment.