diff --git a/src/Discord.Net.Core/Entities/Messages/AttachmentFlags.cs b/src/Discord.Net.Core/Entities/Messages/AttachmentFlags.cs new file mode 100644 index 0000000000..83a61bafcb --- /dev/null +++ b/src/Discord.Net.Core/Entities/Messages/AttachmentFlags.cs @@ -0,0 +1,27 @@ +using System; + +namespace Discord; + +[Flags] +public enum AttachmentFlags +{ + /// + /// The attachment has no flags. + /// + None = 0, + + /// + /// Indicates that this attachment is a clip. + /// + IsClip = 1 << 0, + + /// + /// Indicates that this attachment is a thumbnail. + /// + IsThumbnail = 1 << 1, + + /// + /// Indicates that this attachment has been edited using the remix feature on mobile. + /// + IsRemix = 1 << 2, +} diff --git a/src/Discord.Net.Core/Entities/Messages/IAttachment.cs b/src/Discord.Net.Core/Entities/Messages/IAttachment.cs index 75d1262e24..6e9b4df20e 100644 --- a/src/Discord.Net.Core/Entities/Messages/IAttachment.cs +++ b/src/Discord.Net.Core/Entities/Messages/IAttachment.cs @@ -80,5 +80,10 @@ public interface IAttachment /// Gets the base64 encoded bytearray representing a sampled waveform. if the attachment is not a voice message. /// public string Waveform { get; } + + /// + /// Gets flags related to this to this attachment. + /// + public AttachmentFlags Flags { get; } } } diff --git a/src/Discord.Net.Core/Entities/Roles/IRole.cs b/src/Discord.Net.Core/Entities/Roles/IRole.cs index edb92fb135..ac4719e7b3 100644 --- a/src/Discord.Net.Core/Entities/Roles/IRole.cs +++ b/src/Discord.Net.Core/Entities/Roles/IRole.cs @@ -87,6 +87,11 @@ public interface IRole : ISnowflakeEntity, IDeletable, IMentionable, IComparable /// RoleTags Tags { get; } + /// + /// Gets flags related to this role. + /// + RoleFlags Flags { get; } + /// /// Modifies this role. /// diff --git a/src/Discord.Net.Core/Entities/Roles/RoleFlags.cs b/src/Discord.Net.Core/Entities/Roles/RoleFlags.cs new file mode 100644 index 0000000000..0ed8f12c48 --- /dev/null +++ b/src/Discord.Net.Core/Entities/Roles/RoleFlags.cs @@ -0,0 +1,17 @@ +using System; + +namespace Discord; + +[Flags] +public enum RoleFlags +{ + /// + /// The role has no flags. + /// + None = 0, + + /// + /// Indicates that the role can be selected by members in an onboarding. + /// + InPrompt = 1 << 0, +} diff --git a/src/Discord.Net.Rest/API/Common/Attachment.cs b/src/Discord.Net.Rest/API/Common/Attachment.cs index e26cddb5f9..0cb858af7a 100644 --- a/src/Discord.Net.Rest/API/Common/Attachment.cs +++ b/src/Discord.Net.Rest/API/Common/Attachment.cs @@ -1,32 +1,45 @@ using Newtonsoft.Json; -namespace Discord.API +namespace Discord.API; + +internal class Attachment { - internal class Attachment - { - [JsonProperty("id")] - public ulong Id { get; set; } - [JsonProperty("filename")] - public string Filename { get; set; } - [JsonProperty("description")] - public Optional Description { get; set; } - [JsonProperty("content_type")] - public Optional ContentType { get; set; } - [JsonProperty("size")] - public int Size { get; set; } - [JsonProperty("url")] - public string Url { get; set; } - [JsonProperty("proxy_url")] - public string ProxyUrl { get; set; } - [JsonProperty("height")] - public Optional Height { get; set; } - [JsonProperty("width")] - public Optional Width { get; set; } - [JsonProperty("ephemeral")] - public Optional Ephemeral { get; set; } - [JsonProperty("duration_secs")] - public Optional DurationSeconds { get; set; } - [JsonProperty("waveform")] - public Optional Waveform { get; set; } - } + [JsonProperty("id")] + public ulong Id { get; set; } + + [JsonProperty("filename")] + public string Filename { get; set; } + + [JsonProperty("description")] + public Optional Description { get; set; } + + [JsonProperty("content_type")] + public Optional ContentType { get; set; } + + [JsonProperty("size")] + public int Size { get; set; } + + [JsonProperty("url")] + public string Url { get; set; } + + [JsonProperty("proxy_url")] + public string ProxyUrl { get; set; } + + [JsonProperty("height")] + public Optional Height { get; set; } + + [JsonProperty("width")] + public Optional Width { get; set; } + + [JsonProperty("ephemeral")] + public Optional Ephemeral { get; set; } + + [JsonProperty("duration_secs")] + public Optional DurationSeconds { get; set; } + + [JsonProperty("waveform")] + public Optional Waveform { get; set; } + + [JsonProperty("flags")] + public Optional Flags { get; set; } } diff --git a/src/Discord.Net.Rest/API/Common/Role.cs b/src/Discord.Net.Rest/API/Common/Role.cs index 81f54ccc08..c85640041c 100644 --- a/src/Discord.Net.Rest/API/Common/Role.cs +++ b/src/Discord.Net.Rest/API/Common/Role.cs @@ -1,30 +1,42 @@ using Newtonsoft.Json; -namespace Discord.API +namespace Discord.API; + +internal class Role { - internal class Role - { - [JsonProperty("id")] - public ulong Id { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("icon")] - public Optional Icon { get; set; } - [JsonProperty("unicode_emoji")] - public Optional Emoji { get; set; } - [JsonProperty("color")] - public uint Color { get; set; } - [JsonProperty("hoist")] - public bool Hoist { get; set; } - [JsonProperty("mentionable")] - public bool Mentionable { get; set; } - [JsonProperty("position")] - public int Position { get; set; } - [JsonProperty("permissions"), Int53] - public string Permissions { get; set; } - [JsonProperty("managed")] - public bool Managed { get; set; } - [JsonProperty("tags")] - public Optional Tags { get; set; } - } + [JsonProperty("id")] + public ulong Id { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("icon")] + public Optional Icon { get; set; } + + [JsonProperty("unicode_emoji")] + public Optional Emoji { get; set; } + + [JsonProperty("color")] + public uint Color { get; set; } + + [JsonProperty("hoist")] + public bool Hoist { get; set; } + + [JsonProperty("mentionable")] + public bool Mentionable { get; set; } + + [JsonProperty("position")] + public int Position { get; set; } + + [JsonProperty("permissions"), Int53] + public string Permissions { get; set; } + + [JsonProperty("managed")] + public bool Managed { get; set; } + + [JsonProperty("tags")] + public Optional Tags { get; set; } + + [JsonProperty("flags")] + public RoleFlags Flags { get; set; } } diff --git a/src/Discord.Net.Rest/Entities/Messages/Attachment.cs b/src/Discord.Net.Rest/Entities/Messages/Attachment.cs index fef5207de3..0c425126aa 100644 --- a/src/Discord.Net.Rest/Entities/Messages/Attachment.cs +++ b/src/Discord.Net.Rest/Entities/Messages/Attachment.cs @@ -32,8 +32,11 @@ public class Attachment : IAttachment /// public double? Duration { get; } + /// + public AttachmentFlags Flags { get; } + internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width, - bool? ephemeral, string description, string contentType, double? duration, string waveform) + bool? ephemeral, string description, string contentType, double? duration, string waveform, AttachmentFlags flags) { Id = id; Filename = filename; @@ -47,6 +50,7 @@ internal Attachment(ulong id, string filename, string url, string proxyUrl, int ContentType = contentType; Duration = duration; Waveform = waveform; + Flags = flags; } internal static Attachment Create(Model model) { @@ -56,7 +60,8 @@ internal static Attachment Create(Model model) model.Ephemeral.ToNullable(), model.Description.GetValueOrDefault(), model.ContentType.GetValueOrDefault(), model.DurationSeconds.IsSpecified ? model.DurationSeconds.Value : null, - model.Waveform.GetValueOrDefault(null)); + model.Waveform.GetValueOrDefault(null), + model.Flags.GetValueOrDefault(AttachmentFlags.None)); } /// diff --git a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs index df629bec75..ef111a406c 100644 --- a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs +++ b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs @@ -34,6 +34,9 @@ public class RestRole : RestEntity, IRole /// public RoleTags Tags { get; private set; } + /// + public RoleFlags Flags { get; private set; } + /// public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); /// @@ -63,6 +66,8 @@ internal void Update(Model model) Position = model.Position; Color = new Color(model.Color); Permissions = new GuildPermissions(model.Permissions); + Flags = model.Flags; + if (model.Tags.IsSpecified) Tags = model.Tags.Value.ToEntity(); diff --git a/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs b/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs index a399f2c182..d5b52da0a5 100644 --- a/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs +++ b/src/Discord.Net.WebSocket/Entities/Roles/SocketRole.cs @@ -44,6 +44,9 @@ public class SocketRole : SocketEntity, IRole /// public RoleTags Tags { get; private set; } + /// + public RoleFlags Flags { get; private set; } + /// public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); /// @@ -82,6 +85,8 @@ internal void Update(ClientState state, Model model) Position = model.Position; Color = new Color(model.Color); Permissions = new GuildPermissions(model.Permissions); + Flags = model.Flags; + if (model.Tags.IsSpecified) Tags = model.Tags.Value.ToEntity();