feat(bot): initial ComponentsV2 implementation

This commit is contained in:
Iris System 2025-08-25 11:30:46 +12:00
parent 695d1debf2
commit 517d4d9b56
12 changed files with 401 additions and 67 deletions

View file

@ -9,6 +9,7 @@ public record MessageRequest
public bool Tts { get; set; }
public AllowedMentions? AllowedMentions { get; set; }
public Embed[]? Embeds { get; set; }
public Message.MessageFlags Flags { get; set; }
public MessageComponent[]? Components { get; set; }
public Message.Reference? MessageReference { get; set; }
}

View file

@ -0,0 +1,13 @@
namespace Myriad.Types;
public record ComponentMedia
{
public string? Url { get; init; }
}
public record ComponentMediaItem
{
public ComponentMedia Media { get; init; }
public string? Description { get; init; }
public bool Spoiler { get; init; } = false;
}

View file

@ -3,5 +3,12 @@ namespace Myriad.Types;
public enum ComponentType
{
ActionRow = 1,
Button = 2
Button = 2,
StringSelect = 3,
Section = 9,
Text = 10,
Thumbnail = 11,
MediaGallery = 12,
Separator = 14,
Container = 17,
}

View file

@ -5,9 +5,15 @@ public record MessageComponent
public ComponentType Type { get; init; }
public ButtonStyle? Style { get; set; }
public string? Label { get; init; }
public string? Content { get; init; }
public Emoji? Emoji { get; init; }
public string? CustomId { get; init; }
public string? Url { get; init; }
public bool? Disabled { get; init; }
public uint? AccentColor { get; init; }
public ComponentMedia? Media { get; init; }
public ComponentMediaItem[]? Items { get; init; }
public MessageComponent? Accessory { get; init; }
public MessageComponent[]? Components { get; init; }
}

View file

@ -17,6 +17,7 @@ public record Message
Ephemeral = 1 << 6,
SuppressNotifications = 1 << 12,
VoiceMessage = 1 << 13,
IsComponentsV2 = 1 << 15,
}
public enum MessageType
@ -73,8 +74,6 @@ public record Message
public MessagePoll? Poll { get; init; }
// public MessageComponent[]? Components { get; init; }
public record Reference(ulong? GuildId, ulong? ChannelId, ulong? MessageId);
public record MessageActivity(int Type, string PartyId);