@@ -16,10 +16,10 @@ namespace Discord.Net.Models | |||||
/// <param name="messageId">Id of the message that was targeted.</param> | /// <param name="messageId">Id of the message that was targeted.</param> | ||||
/// <param name="count">Number of entities that were targeted.</param> | /// <param name="count">Number of entities that were targeted.</param> | ||||
/// <param name="id">Id of the overwritten entity.</param> | /// <param name="id">Id of the overwritten entity.</param> | ||||
/// <param name="type">Type of overwritten entity - "0" for "role" or "1" for "member".</param> | |||||
/// <param name="roleName">Name of the role if type is "0" (not present if type is "1").</param> | |||||
/// <param name="type">Type of overwritten entity.</param> | |||||
/// <param name="roleName">Name of the role if type is <see cref="AuditEntryInfoType.Role"/> (not present if type is <see cref="AuditEntryInfoType.Member"/>).</param> | |||||
[JsonConstructor] | [JsonConstructor] | ||||
public AuditEntryInfo(int deleteMemberDays, int membersRemoved, Snowflake channelId, Snowflake messageId, int count, Snowflake id, AuditEntryInfoType type, string roleName) | |||||
public AuditEntryInfo(int? deleteMemberDays, int? membersRemoved, Snowflake? channelId, Snowflake? messageId, int? count, Snowflake? id, AuditEntryInfoType? type, string? roleName) | |||||
{ | { | ||||
DeleteMemberDays = deleteMemberDays; | DeleteMemberDays = deleteMemberDays; | ||||
MembersRemoved = membersRemoved; | MembersRemoved = membersRemoved; | ||||
@@ -35,48 +35,48 @@ namespace Discord.Net.Models | |||||
/// Number of days after which inactive members were kicked. | /// Number of days after which inactive members were kicked. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("delete_member_days")] | [JsonPropertyName("delete_member_days")] | ||||
public int DeleteMemberDays { get; } | |||||
public int? DeleteMemberDays { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Number of members removed by the prune. | /// Number of members removed by the prune. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("members_removed")] | [JsonPropertyName("members_removed")] | ||||
public int MembersRemoved { get; } | |||||
public int? MembersRemoved { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Channel in which the entities were targeted. | /// Channel in which the entities were targeted. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("channel_id")] | [JsonPropertyName("channel_id")] | ||||
public Snowflake ChannelId { get; } | |||||
public Snowflake? ChannelId { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Id of the message that was targeted. | /// Id of the message that was targeted. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("message_id")] | [JsonPropertyName("message_id")] | ||||
public Snowflake MessageId { get; } | |||||
public Snowflake? MessageId { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Number of entities that were targeted. | /// Number of entities that were targeted. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("count")] | [JsonPropertyName("count")] | ||||
public int Count { get; } | |||||
public int? Count { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Id of the overwritten entity. | /// Id of the overwritten entity. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("id")] | [JsonPropertyName("id")] | ||||
public Snowflake Id { get; } | |||||
public Snowflake? Id { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Type of overwritten entity. | /// Type of overwritten entity. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("type")] | [JsonPropertyName("type")] | ||||
public AuditEntryInfoType Type { get; } | |||||
public AuditEntryInfoType? Type { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Name of the role if type is <see cref="AuditEntryInfoType.Role"/> (not present if type is <see cref="AuditEntryInfoType.Member"/>). | /// Name of the role if type is <see cref="AuditEntryInfoType.Role"/> (not present if type is <see cref="AuditEntryInfoType.Member"/>). | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("role_name")] | [JsonPropertyName("role_name")] | ||||
public string RoleName { get; } | |||||
public string? RoleName { get; } | |||||
} | } | ||||
} | } |
@@ -15,7 +15,7 @@ namespace Discord.Net.Models | |||||
/// <param name="users">Array of user_ids to mention (Max size of 100).</param> | /// <param name="users">Array of user_ids to mention (Max size of 100).</param> | ||||
/// <param name="repliedUser">For replies, whether to mention the author of the message being replied to (default false).</param> | /// <param name="repliedUser">For replies, whether to mention the author of the message being replied to (default false).</param> | ||||
[JsonConstructor] | [JsonConstructor] | ||||
public AllowedMentions(AllowedMentionType[] parse, ListOfSnowflakes roles, ListOfSnowflakes users, bool repliedUser) | |||||
public AllowedMentions(string[] parse, Snowflake[] roles, Snowflake[] users, bool repliedUser) | |||||
{ | { | ||||
Parse = parse; | Parse = parse; | ||||
Roles = roles; | Roles = roles; | ||||
@@ -27,19 +27,19 @@ namespace Discord.Net.Models | |||||
/// An array of allowed mention types to parse from the content. | /// An array of allowed mention types to parse from the content. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("parse")] | [JsonPropertyName("parse")] | ||||
public AllowedMentionType[] Parse { get; } | |||||
public string[] Parse { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Array of role_ids to mention (Max size of 100). | /// Array of role_ids to mention (Max size of 100). | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("roles")] | [JsonPropertyName("roles")] | ||||
public ListOfSnowflakes Roles { get; } | |||||
public Snowflake[] Roles { get; } | |||||
/// <summary> | /// <summary> | ||||
/// Array of user_ids to mention (Max size of 100). | /// Array of user_ids to mention (Max size of 100). | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("users")] | [JsonPropertyName("users")] | ||||
public ListOfSnowflakes Users { get; } | |||||
public Snowflake[] Users { get; } | |||||
/// <summary> | /// <summary> | ||||
/// For replies, whether to mention the author of the message being replied to (default false). | /// For replies, whether to mention the author of the message being replied to (default false). | ||||
@@ -42,7 +42,7 @@ namespace Discord.Net.Models | |||||
/// <param name="thread">The thread that was started from this message, includes thread member object.</param> | /// <param name="thread">The thread that was started from this message, includes thread member object.</param> | ||||
/// <param name="components">Sent if the message contains components like buttons, action rows, or other interactive components.</param> | /// <param name="components">Sent if the message contains components like buttons, action rows, or other interactive components.</param> | ||||
[JsonConstructor] | [JsonConstructor] | ||||
public Message(Snowflake id, Snowflake channelId, Optional<Snowflake> guildId, User author, Optional<GuildMember> member, string content, DateTimeOffset timestamp, DateTimeOffset? editedTimestamp, bool tts, bool mentionEveryone, UserWithMember[] mentions, Snowflake[] mentionRoles, Optional<ChannelMention[]> mentionChannels, Attachment[] attachments, Embed[] embeds, Optional<Reaction[]> reactions, Optional<string> nonce, bool pinned, Optional<Snowflake> webhookId, int type, Optional<MessageActivity> activity, Optional<Application> application, Optional<Snowflake> applicationId, Optional<MessageReference> messageReference, Optional<MessageFlags> flags, Optional<Sticker[]> stickers, Optional<Message?> referencedMessage, Optional<MessageInteraction> interaction, Optional<Channel> thread, Optional<Component> components) | |||||
public Message(Snowflake id, Snowflake channelId, Optional<Snowflake> guildId, User author, Optional<GuildMember> member, string content, DateTimeOffset timestamp, DateTimeOffset? editedTimestamp, bool tts, bool mentionEveryone, UserMention[] mentions, Snowflake[] mentionRoles, Optional<ChannelMention[]> mentionChannels, Attachment[] attachments, Embed[] embeds, Optional<Reaction[]> reactions, Optional<string> nonce, bool pinned, Optional<Snowflake> webhookId, int type, Optional<MessageActivity> activity, Optional<Application> application, Optional<Snowflake> applicationId, Optional<MessageReference> messageReference, Optional<MessageFlags> flags, Optional<Sticker[]> stickers, Optional<Message?> referencedMessage, Optional<MessageInteraction> interaction, Optional<Channel> thread, Optional<Component> components) | |||||
{ | { | ||||
Id = id; | Id = id; | ||||
ChannelId = channelId; | ChannelId = channelId; | ||||
@@ -0,0 +1,138 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents an activity object. | |||||
/// </summary> | |||||
public record Activity | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="Activity"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="name">The activity's name.</param> | |||||
/// <param name="type">Activity type.</param> | |||||
/// <param name="url">Stream url, is validated when type is 1.</param> | |||||
/// <param name="createdAt">Unix timestamp of when the activity was added to the user's session.</param> | |||||
/// <param name="timestamps">Unix timestamps for start and/or end of the game.</param> | |||||
/// <param name="applicationId">Application id for the game.</param> | |||||
/// <param name="details">What the player is currently doing.</param> | |||||
/// <param name="state">The user's current party status.</param> | |||||
/// <param name="emoji">The emoji used for a custom status.</param> | |||||
/// <param name="party">Information for the current party of the player.</param> | |||||
/// <param name="assets">Images for the presence and their hover texts.</param> | |||||
/// <param name="secrets">Secrets for Rich Presence joining and spectating.</param> | |||||
/// <param name="instance">Whether or not the activity is an instanced game session.</param> | |||||
/// <param name="flags">Activity flags ORd together, describes what the payload includes.</param> | |||||
/// <param name="buttonLabels">The custom buttons shown in the Rich Presence (max 2).</param> | |||||
[JsonConstructor] | |||||
public Activity(string name, int type, Optional<string?> url, int createdAt, Optional<ActivityTimestamps> timestamps, Optional<Snowflake> applicationId, Optional<string?> details, Optional<string?> state, Optional<Emoji?> emoji, Optional<ActivityParty> party, Optional<ActivityAssets> assets, Optional<ActivitySecrets> secrets, Optional<bool> instance, Optional<int> flags, Optional<string[]> buttonLabels) | |||||
{ | |||||
Name = name; | |||||
Type = type; | |||||
Url = url; | |||||
CreatedAt = createdAt; | |||||
Timestamps = timestamps; | |||||
ApplicationId = applicationId; | |||||
Details = details; | |||||
State = state; | |||||
Emoji = emoji; | |||||
Party = party; | |||||
Assets = assets; | |||||
Secrets = secrets; | |||||
Instance = instance; | |||||
Flags = flags; | |||||
ButtonLabels = buttonLabels; | |||||
} | |||||
/// <summary> | |||||
/// The activity's name. | |||||
/// </summary> | |||||
[JsonPropertyName("name")] | |||||
public string Name { get; } | |||||
/// <summary> | |||||
/// Activity type. | |||||
/// </summary> | |||||
[JsonPropertyName("type")] | |||||
public int Type { get; } | |||||
/// <summary> | |||||
/// Stream url, is validated when type is 1. | |||||
/// </summary> | |||||
[JsonPropertyName("url")] | |||||
public Optional<string?> Url { get; } | |||||
/// <summary> | |||||
/// Unix timestamp of when the activity was added to the user's session. | |||||
/// </summary> | |||||
[JsonPropertyName("created_at")] | |||||
public int CreatedAt { get; } | |||||
/// <summary> | |||||
/// Unix timestamps for start and/or end of the game. | |||||
/// </summary> | |||||
[JsonPropertyName("timestamps")] | |||||
public Optional<ActivityTimestamps> Timestamps { get; } | |||||
/// <summary> | |||||
/// Application id for the game. | |||||
/// </summary> | |||||
[JsonPropertyName("application_id")] | |||||
public Optional<Snowflake> ApplicationId { get; } | |||||
/// <summary> | |||||
/// What the player is currently doing. | |||||
/// </summary> | |||||
[JsonPropertyName("details")] | |||||
public Optional<string?> Details { get; } | |||||
/// <summary> | |||||
/// The user's current party status. | |||||
/// </summary> | |||||
[JsonPropertyName("state")] | |||||
public Optional<string?> State { get; } | |||||
/// <summary> | |||||
/// The emoji used for a custom status. | |||||
/// </summary> | |||||
[JsonPropertyName("emoji")] | |||||
public Optional<Emoji?> Emoji { get; } | |||||
/// <summary> | |||||
/// Information for the current party of the player. | |||||
/// </summary> | |||||
[JsonPropertyName("party")] | |||||
public Optional<ActivityParty> Party { get; } | |||||
/// <summary> | |||||
/// Images for the presence and their hover texts. | |||||
/// </summary> | |||||
[JsonPropertyName("assets")] | |||||
public Optional<ActivityAssets> Assets { get; } | |||||
/// <summary> | |||||
/// Secrets for Rich Presence joining and spectating. | |||||
/// </summary> | |||||
[JsonPropertyName("secrets")] | |||||
public Optional<ActivitySecrets> Secrets { get; } | |||||
/// <summary> | |||||
/// Whether or not the activity is an instanced game session. | |||||
/// </summary> | |||||
[JsonPropertyName("instance")] | |||||
public Optional<bool> Instance { get; } | |||||
/// <summary> | |||||
/// Activity flags ORd together, describes what the payload includes. | |||||
/// </summary> | |||||
[JsonPropertyName("flags")] | |||||
public Optional<int> Flags { get; } | |||||
/// <summary> | |||||
/// The custom buttons shown in the Rich Presence (max 2). | |||||
/// </summary> | |||||
[JsonPropertyName("buttons")] | |||||
public Optional<string[]> ButtonLabels { get; } | |||||
} | |||||
} |
@@ -0,0 +1,50 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents an activity assets object. | |||||
/// </summary> | |||||
public record ActivityAssets | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="ActivityAssets"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="largeImage">The id for a large asset of the activity, usually a snowflake.</param> | |||||
/// <param name="largeText">Text displayed when hovering over the large image of the activity.</param> | |||||
/// <param name="smallImage">The id for a small asset of the activity, usually a snowflake.</param> | |||||
/// <param name="smallText">Text displayed when hovering over the small image of the activity.</param> | |||||
[JsonConstructor] | |||||
public ActivityAssets(Optional<string> largeImage, Optional<string> largeText, Optional<string> smallImage, Optional<string> smallText) | |||||
{ | |||||
LargeImage = largeImage; | |||||
LargeText = largeText; | |||||
SmallImage = smallImage; | |||||
SmallText = smallText; | |||||
} | |||||
/// <summary> | |||||
/// The id for a large asset of the activity, usually a snowflake. | |||||
/// </summary> | |||||
[JsonPropertyName("large_image")] | |||||
public Optional<string> LargeImage { get; } | |||||
/// <summary> | |||||
/// Text displayed when hovering over the large image of the activity. | |||||
/// </summary> | |||||
[JsonPropertyName("large_text")] | |||||
public Optional<string> LargeText { get; } | |||||
/// <summary> | |||||
/// The id for a small asset of the activity, usually a snowflake. | |||||
/// </summary> | |||||
[JsonPropertyName("small_image")] | |||||
public Optional<string> SmallImage { get; } | |||||
/// <summary> | |||||
/// Text displayed when hovering over the small image of the activity. | |||||
/// </summary> | |||||
[JsonPropertyName("small_text")] | |||||
public Optional<string> SmallText { get; } | |||||
} | |||||
} |
@@ -0,0 +1,42 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents an activity emoji object. | |||||
/// </summary> | |||||
public record ActivityEmoji | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="ActivityEmoji"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="name">The name of the emoji.</param> | |||||
/// <param name="id">The id of the emoji.</param> | |||||
/// <param name="animated">Whether this emoji is animated.</param> | |||||
[JsonConstructor] | |||||
public ActivityEmoji(string name, Optional<Snowflake> id, Optional<bool> animated) | |||||
{ | |||||
Name = name; | |||||
Id = id; | |||||
Animated = animated; | |||||
} | |||||
/// <summary> | |||||
/// The name of the emoji. | |||||
/// </summary> | |||||
[JsonPropertyName("name")] | |||||
public string Name { get; } | |||||
/// <summary> | |||||
/// The id of the emoji. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public Optional<Snowflake> Id { get; } | |||||
/// <summary> | |||||
/// Whether this emoji is animated. | |||||
/// </summary> | |||||
[JsonPropertyName("animated")] | |||||
public Optional<bool> Animated { get; } | |||||
} | |||||
} |
@@ -0,0 +1,41 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the activity flags. | |||||
/// </summary> | |||||
[Flags] | |||||
public enum ActivityFlags | |||||
{ | |||||
/// <summary> | |||||
/// Activity instance. | |||||
/// </summary> | |||||
Instance = 1 << 0, | |||||
/// <summary> | |||||
/// Activity join. | |||||
/// </summary> | |||||
Join = 1 << 1, | |||||
/// <summary> | |||||
/// Activity spectate. | |||||
/// </summary> | |||||
Spectate = 1 << 2, | |||||
/// <summary> | |||||
/// Activity join request. | |||||
/// </summary> | |||||
JoinRequest = 1 << 3, | |||||
/// <summary> | |||||
/// Activity sync. | |||||
/// </summary> | |||||
Sync = 1 << 4, | |||||
/// <summary> | |||||
/// Activity play. | |||||
/// </summary> | |||||
Play = 1 << 5, | |||||
} | |||||
} |
@@ -0,0 +1,34 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents an activity party object. | |||||
/// </summary> | |||||
public record ActivityParty | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="ActivityParty"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="id">The id of the party.</param> | |||||
/// <param name="size">Used to show the party's current and maximum size.</param> | |||||
[JsonConstructor] | |||||
public ActivityParty(Optional<string> id, Optional<int[]> size) | |||||
{ | |||||
Id = id; | |||||
Size = size; | |||||
} | |||||
/// <summary> | |||||
/// The id of the party. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public Optional<string> Id { get; } | |||||
/// <summary> | |||||
/// Used to show the party's current and maximum size. | |||||
/// </summary> | |||||
[JsonPropertyName("size")] | |||||
public Optional<int[]> Size { get; } | |||||
} | |||||
} |
@@ -0,0 +1,42 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents an activity secrets object. | |||||
/// </summary> | |||||
public record ActivitySecrets | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="ActivitySecrets"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="join">The secret for joining a party.</param> | |||||
/// <param name="spectate">The secret for spectating a game.</param> | |||||
/// <param name="match">The secret for a specific instanced match.</param> | |||||
[JsonConstructor] | |||||
public ActivitySecrets(Optional<string> join, Optional<string> spectate, Optional<string> match) | |||||
{ | |||||
Join = join; | |||||
Spectate = spectate; | |||||
Match = match; | |||||
} | |||||
/// <summary> | |||||
/// The secret for joining a party. | |||||
/// </summary> | |||||
[JsonPropertyName("join")] | |||||
public Optional<string> Join { get; } | |||||
/// <summary> | |||||
/// The secret for spectating a game. | |||||
/// </summary> | |||||
[JsonPropertyName("spectate")] | |||||
public Optional<string> Spectate { get; } | |||||
/// <summary> | |||||
/// The secret for a specific instanced match. | |||||
/// </summary> | |||||
[JsonPropertyName("match")] | |||||
public Optional<string> Match { get; } | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using System; | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents an activity timestamp object. | |||||
/// </summary> | |||||
public record ActivityTimestamps | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="ActivityTimestamps"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="start">When the activity started.</param> | |||||
/// <param name="end">When the activity ends.</param> | |||||
[JsonConstructor] | |||||
public ActivityTimestamps(Optional<DateTimeOffset> start, Optional<DateTimeOffset> end) | |||||
{ | |||||
Start = start; | |||||
End = end; | |||||
} | |||||
/// <summary> | |||||
/// When the activity started. | |||||
/// </summary> | |||||
[JsonPropertyName("start")] | |||||
public Optional<DateTimeOffset> Start { get; } | |||||
/// <summary> | |||||
/// When the activity ends. | |||||
/// </summary> | |||||
[JsonPropertyName("end")] | |||||
public Optional<DateTimeOffset> End { get; } | |||||
} | |||||
} |
@@ -0,0 +1,38 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the activity type. | |||||
/// </summary> | |||||
public enum ActivityType | |||||
{ | |||||
/// <summary> | |||||
/// Playing {name}. | |||||
/// </summary> | |||||
Game = 0, | |||||
/// <summary> | |||||
/// Streaming {details}. | |||||
/// </summary> | |||||
Streaming = 1, | |||||
/// <summary> | |||||
/// Listening to {name}. | |||||
/// </summary> | |||||
Listening = 2, | |||||
/// <summary> | |||||
/// Watching {name}. | |||||
/// </summary> | |||||
Watching = 3, | |||||
/// <summary> | |||||
/// {emoji} {name}. | |||||
/// </summary> | |||||
Custom = 4, | |||||
/// <summary> | |||||
/// Competing in {name}. | |||||
/// </summary> | |||||
Competing = 5, | |||||
} | |||||
} |
@@ -0,0 +1,42 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a client status object. | |||||
/// </summary> | |||||
public record ClientStatus | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="ClientStatus"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="desktop">The user's status set for an active desktop (Windows, Linux, Mac) application session.</param> | |||||
/// <param name="mobile">The user's status set for an active mobile (iOS, Android) application session.</param> | |||||
/// <param name="web">The user's status set for an active web (browser, bot account) application session.</param> | |||||
[JsonConstructor] | |||||
public ClientStatus(Optional<string> desktop, Optional<string> mobile, Optional<string> web) | |||||
{ | |||||
Desktop = desktop; | |||||
Mobile = mobile; | |||||
Web = web; | |||||
} | |||||
/// <summary> | |||||
/// The user's status set for an active desktop (Windows, Linux, Mac) application session. | |||||
/// </summary> | |||||
[JsonPropertyName("desktop")] | |||||
public Optional<string> Desktop { get; } | |||||
/// <summary> | |||||
/// The user's status set for an active mobile (iOS, Android) application session. | |||||
/// </summary> | |||||
[JsonPropertyName("mobile")] | |||||
public Optional<string> Mobile { get; } | |||||
/// <summary> | |||||
/// The user's status set for an active web (browser, bot account) application session. | |||||
/// </summary> | |||||
[JsonPropertyName("web")] | |||||
public Optional<string> Web { get; } | |||||
} | |||||
} |
@@ -0,0 +1,58 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a presence object. | |||||
/// </summary> | |||||
public record Presence | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="Presence"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="user">The user presence is being updated for.</param> | |||||
/// <param name="guildId">Id of the guild.</param> | |||||
/// <param name="status">Either "idle", "dnd", "online", or "offline".</param> | |||||
/// <param name="activities">User's current activities.</param> | |||||
/// <param name="clientStatus">User's platform-dependent status.</param> | |||||
[JsonConstructor] | |||||
public Presence(User user, Snowflake guildId, string status, Activity[] activities, ClientStatus clientStatus) | |||||
{ | |||||
User = user; | |||||
GuildId = guildId; | |||||
Status = status; | |||||
Activities = activities; | |||||
ClientStatus = clientStatus; | |||||
} | |||||
/// <summary> | |||||
/// The user presence is being updated for. | |||||
/// </summary> | |||||
[JsonPropertyName("user")] | |||||
public User User { get; } | |||||
/// <summary> | |||||
/// Id of the guild. | |||||
/// </summary> | |||||
[JsonPropertyName("guild_id")] | |||||
public Snowflake GuildId { get; } | |||||
/// <summary> | |||||
/// Either "idle", "dnd", "online", or "offline". | |||||
/// </summary> | |||||
[JsonPropertyName("status")] | |||||
public string Status { get; } | |||||
/// <summary> | |||||
/// User's current activities. | |||||
/// </summary> | |||||
[JsonPropertyName("activities")] | |||||
public Activity[] Activities { get; } | |||||
/// <summary> | |||||
/// User's platform-dependent status. | |||||
/// </summary> | |||||
[JsonPropertyName("client_status")] | |||||
public ClientStatus ClientStatus { get; } | |||||
} | |||||
} |
@@ -61,7 +61,7 @@ namespace Discord.Net.Models | |||||
/// <param name="nsfwLevel">Guild NSFW level.</param> | /// <param name="nsfwLevel">Guild NSFW level.</param> | ||||
/// <param name="stageInstances">Stage instances in the guild.</param> | /// <param name="stageInstances">Stage instances in the guild.</param> | ||||
[JsonConstructor] | [JsonConstructor] | ||||
public Guild(Snowflake id, string name, string? icon, Optional<string?> iconHash, string? splash, string? discoverySplash, Optional<bool> owner, Snowflake ownerId, Optional<Permissions> permissions, string region, Snowflake? afkChannelId, int afkTimeout, Optional<bool> widgetEnabled, Optional<Snowflake?> widgetChannelId, int verificationLevel, int defaultMessageNotifications, int explicitContentFilter, Role[] roles, Emoji[] emojis, string[] features, int mfaLevel, Snowflake? applicationId, Snowflake? systemChannelId, int systemChannelFlags, Snowflake? rulesChannelId, Optional<DateTimeOffset> joinedAt, Optional<bool> large, Optional<bool> unavailable, Optional<int> memberCount, Optional<VoiceState[]> voiceStates, Optional<GuildMember[]> members, Optional<Channel[]> channels, Optional<Channel[]> threads, Optional<PresenceUpdate[]> presences, Optional<int?> maxPresences, Optional<int> maxMembers, string? vanityUrlCode, string? description, string? banner, int premiumTier, Optional<int> premiumSubscriptionCount, string preferredLocale, Snowflake? publicUpdatesChannelId, Optional<int> maxVideoChannelUsers, Optional<int> approximateMemberCount, Optional<int> approximatePresenceCount, Optional<WelcomeScreen> welcomeScreen, int nsfwLevel, Optional<StageInstance[]> stageInstances) | |||||
public Guild(Snowflake id, string name, string? icon, Optional<string?> iconHash, string? splash, string? discoverySplash, Optional<bool> owner, Snowflake ownerId, Optional<Permissions> permissions, string region, Snowflake? afkChannelId, int afkTimeout, Optional<bool> widgetEnabled, Optional<Snowflake?> widgetChannelId, int verificationLevel, int defaultMessageNotifications, int explicitContentFilter, Role[] roles, Emoji[] emojis, string[] features, int mfaLevel, Snowflake? applicationId, Snowflake? systemChannelId, int systemChannelFlags, Snowflake? rulesChannelId, Optional<DateTimeOffset> joinedAt, Optional<bool> large, Optional<bool> unavailable, Optional<int> memberCount, Optional<VoiceState[]> voiceStates, Optional<GuildMember[]> members, Optional<Channel[]> channels, Optional<Channel[]> threads, Optional<Presence[]> presences, Optional<int?> maxPresences, Optional<int> maxMembers, string? vanityUrlCode, string? description, string? banner, int premiumTier, Optional<int> premiumSubscriptionCount, string preferredLocale, Snowflake? publicUpdatesChannelId, Optional<int> maxVideoChannelUsers, Optional<int> approximateMemberCount, Optional<int> approximatePresenceCount, Optional<WelcomeScreen> welcomeScreen, int nsfwLevel, Optional<StageInstance[]> stageInstances) | |||||
{ | { | ||||
Id = id; | Id = id; | ||||
Name = name; | Name = name; | ||||
@@ -316,7 +316,7 @@ namespace Discord.Net.Models | |||||
/// Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold. | /// Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold. | ||||
/// </summary> | /// </summary> | ||||
[JsonPropertyName("presences")] | [JsonPropertyName("presences")] | ||||
public Optional<PresenceUpdate[]> Presences { get; } | |||||
public Optional<Presence[]> Presences { get; } | |||||
/// <summary> | /// <summary> | ||||
/// The maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned). | /// The maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned). | ||||