Skip to content

Commit

Permalink
[All] make IsLargeFace not nullable (#663)
Browse files Browse the repository at this point in the history
  • Loading branch information
pk5ls20 authored Oct 28, 2024
1 parent 7815fc8 commit f1f97b5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Lagrange.Core/Message/Entity/FaceEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ public class FaceEntity : IMessageEntity
{
public ushort FaceId { get; set; }

public bool? IsLargeFace { get; set; }
public bool IsLargeFace { get; set; }

public SysFaceEntry? SysFaceEntry { get; set; }

public FaceEntity() { }

public FaceEntity(ushort faceId, bool? isLargeFace)
public FaceEntity(ushort faceId, bool isLargeFace)
{
FaceId = faceId;
IsLargeFace = isLargeFace;
}

IEnumerable<Elem> IMessageEntity.PackElement()
{
if (IsLargeFace ?? false)
if (IsLargeFace)
{
var qBigFace = new QBigFaceExtra
{
Expand Down Expand Up @@ -106,5 +106,5 @@ IEnumerable<Elem> IMessageEntity.PackElement()
return null;
}

public string ToPreviewString() => $"[Face][{(IsLargeFace ?? false ? "Large" : "Small")}]: {FaceId}";
public string ToPreviewString() => $"[Face][{(IsLargeFace ? "Large" : "Small")}]: {FaceId}";
}
2 changes: 1 addition & 1 deletion Lagrange.Core/Message/MessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public MessageBuilder Mention(uint target, string? display = null)
/// </summary>
/// <param name="id">The id of emoji</param>
/// <param name="isLarge">Is the emoji large</param>
public MessageBuilder Face(ushort id, bool? isLarge = false)
public MessageBuilder Face(ushort id, bool isLarge = false)
{
var faceEntity = new FaceEntity(id, isLarge);
_chain.Add(faceEntity);
Expand Down
2 changes: 1 addition & 1 deletion Lagrange.OneBot/Message/Entity/FaceSegment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class FaceSegment : SegmentBase

public override void Build(MessageBuilder builder, SegmentBase segment)
{
if (segment is FaceSegment faceSegment) builder.Face(ushort.Parse(faceSegment.Id), faceSegment.IsLarge);
if (segment is FaceSegment faceSegment) builder.Face(ushort.Parse(faceSegment.Id), faceSegment.IsLarge ?? false);
}

public override SegmentBase? FromEntity(MessageChain chain, IMessageEntity entity)
Expand Down

0 comments on commit f1f97b5

Please sign in to comment.