@@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Gateway.UnitTes | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Models", "src\Models\Discord.Net.Models.csproj", "{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Rest", "src\Rest\Discord.Net.Rest.csproj", "{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
@@ -75,6 +77,18 @@ Global | |||
{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}.Release|x64.Build.0 = Release|Any CPU | |||
{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}.Release|x86.ActiveCfg = Release|Any CPU | |||
{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}.Release|x86.Build.0 = Release|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Debug|x64.Build.0 = Debug|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Debug|x86.Build.0 = Debug|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Release|x64.ActiveCfg = Release|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Release|x64.Build.0 = Release|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Release|x86.ActiveCfg = Release|Any CPU | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -84,6 +98,7 @@ Global | |||
{54A6E396-5186-4D79-893B-6EFD1CF658CB} = {6D7B7A29-83FE-44F2-85E1-7D44B061EA27} | |||
{7EC53EB6-6C15-4FD7-9B83-95F96025C14D} = {A47FC28E-1835-46C3-AFD5-7C048A43C157} | |||
{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17} = {CD5CFA4B-143E-4495-8BFD-AF419226CBE5} | |||
{1BD9BEE5-8DAA-429A-8692-A0009D2CB90E} = {CD5CFA4B-143E-4495-8BFD-AF419226CBE5} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {36B0BFC9-AF79-4D25-89D4-2EE3C961612B} | |||
@@ -1,163 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents an application object. | |||
/// </summary> | |||
public record Application | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Application"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">The id of the app.</param> | |||
/// <param name="name">The name of the app.</param> | |||
/// <param name="icon">The icon hash of the app.</param> | |||
/// <param name="description">The description of the app.</param> | |||
/// <param name="rpcOrigins">An array of rpc origin urls, if rpc is enabled.</param> | |||
/// <param name="botPublic">When false only app owner can join the app's bot to guilds.</param> | |||
/// <param name="botRequireCodeGrant">When true the app's bot will only join upon completion of the full oauth2 code grant flow.</param> | |||
/// <param name="termsOfServiceUrl">The url of the app's terms of service.</param> | |||
/// <param name="privacyPolicyUrl">The url of the app's privacy policy.</param> | |||
/// <param name="owner">Partial user object containing info on the owner of the application.</param> | |||
/// <param name="summary">If this application is a game sold on Discord, this field will be the summary field for the store page of its primary sku.</param> | |||
/// <param name="verifyKey">The hex encoded key for verification in interactions and the GameSDK's GetTicket.</param> | |||
/// <param name="team">If the application belongs to a team, this will be a list of the members of that team.</param> | |||
/// <param name="guildId">If this application is a game sold on Discord, this field will be the guild to which it has been linked.</param> | |||
/// <param name="primarySkuId">If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists.</param> | |||
/// <param name="slug">If this application is a game sold on Discord, this field will be the URL slug that links to the store page.</param> | |||
/// <param name="coverImage">The application's default rich presence invite cover image hash.</param> | |||
/// <param name="flags">The application's public flags.</param> | |||
[JsonConstructor] | |||
public Application(Snowflake id, string name, string? icon, string description, Optional<string[]> rpcOrigins, bool botPublic, bool botRequireCodeGrant, Optional<string> termsOfServiceUrl, Optional<string> privacyPolicyUrl, User owner, string summary, string verifyKey, Team? team, Optional<Snowflake> guildId, Optional<Snowflake> primarySkuId, Optional<string> slug, Optional<string> coverImage, ApplicationFlags flags) | |||
{ | |||
Id = id; | |||
Name = name; | |||
Icon = icon; | |||
Description = description; | |||
RpcOrigins = rpcOrigins; | |||
BotPublic = botPublic; | |||
BotRequireCodeGrant = botRequireCodeGrant; | |||
TermsOfServiceUrl = termsOfServiceUrl; | |||
PrivacyPolicyUrl = privacyPolicyUrl; | |||
Owner = owner; | |||
Summary = summary; | |||
VerifyKey = verifyKey; | |||
Team = team; | |||
GuildId = guildId; | |||
PrimarySkuId = primarySkuId; | |||
Slug = slug; | |||
CoverImage = coverImage; | |||
Flags = flags; | |||
} | |||
/// <summary> | |||
/// The id of the app. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// The name of the app. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// The icon hash of the app. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public string? Icon { get; } | |||
/// <summary> | |||
/// The description of the app. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string Description { get; } | |||
/// <summary> | |||
/// An array of rpc origin urls, if rpc is enabled. | |||
/// </summary> | |||
[JsonPropertyName("rpc_origins")] | |||
public Optional<string[]> RpcOrigins { get; } | |||
/// <summary> | |||
/// When false only app owner can join the app's bot to guilds. | |||
/// </summary> | |||
[JsonPropertyName("bot_public")] | |||
public bool BotPublic { get; } | |||
/// <summary> | |||
/// When true the app's bot will only join upon completion of the full oauth2 code grant flow. | |||
/// </summary> | |||
[JsonPropertyName("bot_require_code_grant")] | |||
public bool BotRequireCodeGrant { get; } | |||
/// <summary> | |||
/// The url of the app's terms of service. | |||
/// </summary> | |||
[JsonPropertyName("terms_of_service_url")] | |||
public Optional<string> TermsOfServiceUrl { get; } | |||
/// <summary> | |||
/// The url of the app's privacy policy. | |||
/// </summary> | |||
[JsonPropertyName("privacy_policy_url")] | |||
public Optional<string> PrivacyPolicyUrl { get; } | |||
/// <summary> | |||
/// Partial user object containing info on the owner of the application. | |||
/// </summary> | |||
[JsonPropertyName("owner")] | |||
public User Owner { get; } | |||
/// <summary> | |||
/// If this application is a game sold on Discord, this field will be the summary field for the store page of its primary sku. | |||
/// </summary> | |||
[JsonPropertyName("summary")] | |||
public string Summary { get; } | |||
/// <summary> | |||
/// The hex encoded key for verification in interactions and the GameSDK's GetTicket. | |||
/// </summary> | |||
[JsonPropertyName("verify_key")] | |||
public string VerifyKey { get; } | |||
/// <summary> | |||
/// If the application belongs to a team, this will be a list of the members of that team. | |||
/// </summary> | |||
[JsonPropertyName("team")] | |||
public Team? Team { get; } | |||
/// <summary> | |||
/// If this application is a game sold on Discord, this field will be the guild to which it has been linked. | |||
/// </summary> | |||
[JsonPropertyName("guild_id")] | |||
public Optional<Snowflake> GuildId { get; } | |||
/// <summary> | |||
/// If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists. | |||
/// </summary> | |||
[JsonPropertyName("primary_sku_id")] | |||
public Optional<Snowflake> PrimarySkuId { get; } | |||
/// <summary> | |||
/// If this application is a game sold on Discord, this field will be the URL slug that links to the store page. | |||
/// </summary> | |||
[JsonPropertyName("slug")] | |||
public Optional<string> Slug { get; } | |||
/// <summary> | |||
/// The application's default rich presence invite cover image hash. | |||
/// </summary> | |||
[JsonPropertyName("cover_image")] | |||
public Optional<string> CoverImage { get; } | |||
/// <summary> | |||
/// The application's public flags. | |||
/// </summary> | |||
[JsonPropertyName("flags")] | |||
public ApplicationFlags Flags { get; } | |||
} | |||
} |
@@ -1,41 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the application flags. | |||
/// </summary> | |||
[Flags] | |||
public enum ApplicationFlags | |||
{ | |||
/// <summary> | |||
/// This application has the gateway presence privileged intent. | |||
/// </summary> | |||
GatewayPresence = 1 << 12, | |||
/// <summary> | |||
/// This application has the gateway presence limited. | |||
/// </summary> | |||
GatewayPresenceLimited = 1 << 13, | |||
/// <summary> | |||
/// This application has the gateway guild members privileged intent. | |||
/// </summary> | |||
GatewayGuildMembers = 1 << 14, | |||
/// <summary> | |||
/// This application has the gateway guid members limited. | |||
/// </summary> | |||
GatewayGuildMembersLimited = 1 << 15, | |||
/// <summary> | |||
/// This application has the verification for the increase of the guild limit pending. | |||
/// </summary> | |||
VerificationPendingGuildLimit = 1 << 16, | |||
/// <summary> | |||
/// This application is embedded. | |||
/// </summary> | |||
Embedded = 1 << 17, | |||
} | |||
} |
@@ -0,0 +1,126 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord application object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/application#application-object-application-structure"/> | |||
/// </remarks> | |||
public record Application | |||
{ | |||
/// <summary> | |||
/// The id of the <see cref="Application"/>. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; init; } | |||
/// <summary> | |||
/// The name of the <see cref="Application"/>. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The icon hash of the <see cref="Application"/>. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public string? Icon { get; init; } | |||
/// <summary> | |||
/// The description of the <see cref="Application"/>. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; init; } // Required property candidate | |||
/// <summary> | |||
/// An array of rpc origin urls, if rpc is enabled. | |||
/// </summary> | |||
[JsonPropertyName("rpc_origins")] | |||
public Optional<string[]> RpcOrigins { get; init; } | |||
/// <summary> | |||
/// When false only app owner can join the <see cref="Application"/>'s bot to <see cref="Guild"/>s. | |||
/// </summary> | |||
[JsonPropertyName("bot_public")] | |||
public bool BotPublic { get; init; } | |||
/// <summary> | |||
/// When true the app's bot will only join upon completion of the full oauth2 code grant flow. | |||
/// </summary> | |||
[JsonPropertyName("bot_require_code_grant")] | |||
public bool BotRequireCodeGrant { get; init; } | |||
/// <summary> | |||
/// The url of the <see cref="Application"/>'s terms of service. | |||
/// </summary> | |||
[JsonPropertyName("terms_of_service_url")] | |||
public Optional<string> TermsOfServiceUrl { get; init; } | |||
/// <summary> | |||
/// The url of the <see cref="Application"/>'s privacy policy. | |||
/// </summary> | |||
[JsonPropertyName("privacy_policy_url")] | |||
public Optional<string> PrivacyPolicyUrl { get; init; } | |||
/// <summary> | |||
/// Partial <see cref="User"/> containing info on the owner of the <see cref="Application"/>. | |||
/// </summary> | |||
[JsonPropertyName("owner")] | |||
public User? Owner { get; init; } // Required property candidate | |||
/// <summary> | |||
/// If this <see cref="Application"/> is a game sold on Discord, this field will be | |||
/// the summary field for the store page of its primary sku. | |||
/// </summary> | |||
[JsonPropertyName("summary")] | |||
public string? Summary { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The hex encoded key for verification in interactions and the GameSDK's GetTicket. | |||
/// </summary> | |||
[JsonPropertyName("verify_key")] | |||
public string? VerifyKey { get; init; } // Required property candidate | |||
/// <summary> | |||
/// If the <see cref="Application"/> belongs to a <see cref="Models.Team"/>, | |||
/// this will be a list of the <see cref="TeamMember"/>s of that <see cref="Models.Team"/>. | |||
/// </summary> | |||
[JsonPropertyName("team")] | |||
public Team? Team { get; init; } | |||
/// <summary> | |||
/// If this <see cref="Application"/> is a game sold on Discord, this field will | |||
/// be the <see cref="Guild"/> to which it has been linked. | |||
/// </summary> | |||
[JsonPropertyName("guild_id")] | |||
public Optional<Snowflake> GuildId { get; init; } | |||
/// <summary> | |||
/// If this <see cref="Application"/> is a game sold on Discord, this field will | |||
/// be the id of the "Game SKU" that is created, if exists. | |||
/// </summary> | |||
[JsonPropertyName("primary_sku_id")] | |||
public Optional<Snowflake> PrimarySkuId { get; init; } | |||
/// <summary> | |||
/// If this <see cref="Application"/> is a game sold on Discord, this field will | |||
/// be the URL slug that links to the store page. | |||
/// </summary> | |||
[JsonPropertyName("slug")] | |||
public Optional<string> Slug { get; init; } | |||
/// <summary> | |||
/// The <see cref="Application"/>'s default rich presence invite cover image hash. | |||
/// </summary> | |||
[JsonPropertyName("cover_image")] | |||
public Optional<string> CoverImage { get; init; } | |||
/// <summary> | |||
/// The <see cref="Application"/>'s public flags. | |||
/// </summary> | |||
[JsonPropertyName("flags")] | |||
public ApplicationFlags Flags { get; init; } | |||
} | |||
} |
@@ -0,0 +1,44 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares a flag enum which represents the application flags for an <see cref="Application"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/application#application-object-application-flags"/> | |||
/// </remarks> | |||
[Flags] | |||
public enum ApplicationFlags | |||
{ | |||
/// <summary> | |||
/// This application has the gateway presence privileged intent. | |||
/// </summary> | |||
GatewayPresence = 1 << 12, | |||
/// <summary> | |||
/// This application has the gateway presence limited. | |||
/// </summary> | |||
GatewayPresenceLimited = 1 << 13, | |||
/// <summary> | |||
/// This application has the gateway guild members privileged intent. | |||
/// </summary> | |||
GatewayGuildMembers = 1 << 14, | |||
/// <summary> | |||
/// This application has the gateway guid members limited. | |||
/// </summary> | |||
GatewayGuildMembersLimited = 1 << 15, | |||
/// <summary> | |||
/// This application has the verification for the increase of the guild limit pending. | |||
/// </summary> | |||
VerificationPendingGuildLimit = 1 << 16, | |||
/// <summary> | |||
/// This application is embedded. | |||
/// </summary> | |||
Embedded = 1 << 17, | |||
} | |||
} |
@@ -1,82 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents an audit entry info object. | |||
/// </summary> | |||
public record AuditEntryInfo | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="AuditEntryInfo"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="deleteMemberDays">Number of days after which inactive members were kicked.</param> | |||
/// <param name="membersRemoved">Number of members removed by the prune.</param> | |||
/// <param name="channelId">Channel in which the entities were 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="id">Id of the overwritten entity.</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] | |||
public AuditEntryInfo(int? deleteMemberDays, int? membersRemoved, Snowflake? channelId, Snowflake? messageId, int? count, Snowflake? id, AuditEntryInfoType? type, string? roleName) | |||
{ | |||
DeleteMemberDays = deleteMemberDays; | |||
MembersRemoved = membersRemoved; | |||
ChannelId = channelId; | |||
MessageId = messageId; | |||
Count = count; | |||
Id = id; | |||
Type = type; | |||
RoleName = roleName; | |||
} | |||
/// <summary> | |||
/// Number of days after which inactive members were kicked. | |||
/// </summary> | |||
[JsonPropertyName("delete_member_days")] | |||
public int? DeleteMemberDays { get; } | |||
/// <summary> | |||
/// Number of members removed by the prune. | |||
/// </summary> | |||
[JsonPropertyName("members_removed")] | |||
public int? MembersRemoved { get; } | |||
/// <summary> | |||
/// Channel in which the entities were targeted. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake? ChannelId { get; } | |||
/// <summary> | |||
/// Id of the message that was targeted. | |||
/// </summary> | |||
[JsonPropertyName("message_id")] | |||
public Snowflake? MessageId { get; } | |||
/// <summary> | |||
/// Number of entities that were targeted. | |||
/// </summary> | |||
[JsonPropertyName("count")] | |||
public int? Count { get; } | |||
/// <summary> | |||
/// Id of the overwritten entity. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake? Id { get; } | |||
/// <summary> | |||
/// Type of overwritten entity. | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public AuditEntryInfoType? Type { get; } | |||
/// <summary> | |||
/// Name of the role if type is <see cref="AuditEntryInfoType.Role"/> (not present if type is <see cref="AuditEntryInfoType.Member"/>). | |||
/// </summary> | |||
[JsonPropertyName("role_name")] | |||
public string? RoleName { get; } | |||
} | |||
} |
@@ -1,17 +0,0 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the type of the overwritten entity for an audit entry info. | |||
/// </summary> | |||
public enum AuditEntryInfoType | |||
{ | |||
/// <summary> | |||
/// The type of the overwritten entity is a role. | |||
/// </summary> | |||
Role = 0, | |||
/// <summary> | |||
/// The type of the overwritten entity is a member. | |||
/// </summary> | |||
Member = 1, | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents an audit log object. | |||
/// </summary> | |||
public record AuditLog | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="AuditLog"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="webhooks">List of webhooks found in the audit log.</param> | |||
/// <param name="users">List of users found in the audit log.</param> | |||
/// <param name="auditLogEntries">List of audit log entries.</param> | |||
/// <param name="integrations">List of partial integration objects.</param> | |||
[JsonConstructor] | |||
public AuditLog(Webhook[] webhooks, User[] users, AuditLogEntry[] auditLogEntries, Integration[] integrations) | |||
{ | |||
Webhooks = webhooks; | |||
Users = users; | |||
AuditLogEntries = auditLogEntries; | |||
Integrations = integrations; | |||
} | |||
/// <summary> | |||
/// List of webhooks found in the audit log. | |||
/// </summary> | |||
[JsonPropertyName("webhooks")] | |||
public Webhook[] Webhooks { get; } | |||
/// <summary> | |||
/// List of users found in the audit log. | |||
/// </summary> | |||
[JsonPropertyName("users")] | |||
public User[] Users { get; } | |||
/// <summary> | |||
/// List of audit log entries. | |||
/// </summary> | |||
[JsonPropertyName("audit_log_entries")] | |||
public AuditLogEntry[] AuditLogEntries { get; } | |||
/// <summary> | |||
/// List of partial integration objects. | |||
/// </summary> | |||
[JsonPropertyName("integrations")] | |||
public Integration[] Integrations { get; } | |||
} | |||
} |
@@ -1,42 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents an audit log change object. | |||
/// </summary> | |||
public record AuditLogChange | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="AuditLogChange"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="newValue">New value of the key.</param> | |||
/// <param name="oldValue">Old value of the key.</param> | |||
/// <param name="key">Name of audit log change key.</param> | |||
[JsonConstructor] | |||
public AuditLogChange(Optional<object> newValue, Optional<object> oldValue, string key) | |||
{ | |||
NewValue = newValue; | |||
OldValue = oldValue; | |||
Key = key; | |||
} | |||
/// <summary> | |||
/// New value of the key. | |||
/// </summary> | |||
[JsonPropertyName("new_value")] | |||
public Optional<object> NewValue { get; } | |||
/// <summary> | |||
/// Old value of the key. | |||
/// </summary> | |||
[JsonPropertyName("old_value")] | |||
public Optional<object> OldValue { get; } | |||
/// <summary> | |||
/// Name of audit log change key. | |||
/// </summary> | |||
[JsonPropertyName("key")] | |||
public string Key { get; } | |||
} | |||
} |
@@ -1,74 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents an audit log entry object. | |||
/// </summary> | |||
public record AuditLogEntry | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="AuditLogEntry"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="targetId">Id of the affected entity (webhook, user, role, etc.).</param> | |||
/// <param name="changes">Changes made to the target_id.</param> | |||
/// <param name="userId">The user who made the changes.</param> | |||
/// <param name="id">Id of the entry.</param> | |||
/// <param name="actionType">Type of action that occurred.</param> | |||
/// <param name="options">Additional info for certain action types.</param> | |||
/// <param name="reason">The reason for the change (0-512 characters).</param> | |||
[JsonConstructor] | |||
public AuditLogEntry(string? targetId, Optional<AuditLogChange[]> changes, Snowflake? userId, Snowflake id, AuditLogEvent actionType, Optional<AuditEntryInfo> options, Optional<string> reason) | |||
{ | |||
TargetId = targetId; | |||
Changes = changes; | |||
UserId = userId; | |||
Id = id; | |||
ActionType = actionType; | |||
Options = options; | |||
Reason = reason; | |||
} | |||
/// <summary> | |||
/// Id of the affected entity (webhook, user, role, etc.). | |||
/// </summary> | |||
[JsonPropertyName("target_id")] | |||
public string? TargetId { get; } | |||
/// <summary> | |||
/// Changes made to the target_id. | |||
/// </summary> | |||
[JsonPropertyName("changes")] | |||
public Optional<AuditLogChange[]> Changes { get; } | |||
/// <summary> | |||
/// The user who made the changes. | |||
/// </summary> | |||
[JsonPropertyName("user_id")] | |||
public Snowflake? UserId { get; } | |||
/// <summary> | |||
/// Id of the entry. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Type of action that occurred. | |||
/// </summary> | |||
[JsonPropertyName("action_type")] | |||
public AuditLogEvent ActionType { get; } | |||
/// <summary> | |||
/// Additional info for certain action types. | |||
/// </summary> | |||
[JsonPropertyName("options")] | |||
public Optional<AuditEntryInfo> Options { get; } | |||
/// <summary> | |||
/// The reason for the change (0-512 characters). | |||
/// </summary> | |||
[JsonPropertyName("reason")] | |||
public Optional<string> Reason { get; } | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the type of the overwritten entity for an <see cref="OptionalAuditEntryInfo"/>. | |||
/// </summary> | |||
public enum AuditEntryInfoType | |||
{ | |||
/// <summary> | |||
/// The type of the overwritten entity is a <see cref="Role"/>. | |||
/// </summary> | |||
Role = 0, | |||
/// <summary> | |||
/// The type of the overwritten entity is a <see cref="GuildMember"/>. | |||
/// </summary> | |||
GuildMember = 1, | |||
} | |||
} |
@@ -0,0 +1,52 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord audit log object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure"/> | |||
/// </remarks> | |||
public record AuditLog | |||
{ | |||
/// <summary> | |||
/// Minimum amount of <see cref="AuditLogEntry"/> in <see cref="AuditLogEntries"/>. | |||
/// </summary> | |||
public const int MinimumGetEntryAmount = 1; | |||
/// <summary> | |||
/// Default amount of <see cref="AuditLogEntry"/> in <see cref="AuditLogEntries"/>. | |||
/// </summary> | |||
public const int DefaultGetEntryAmount = 50; | |||
/// <summary> | |||
/// Maximum amount of <see cref="AuditLogEntry"/> in <see cref="AuditLogEntries"/>. | |||
/// </summary> | |||
public const int MaximumGetEntryAmount = 100; | |||
/// <summary> | |||
/// List of <see cref="Webhook"/>s found in the <see cref="AuditLog"/>. | |||
/// </summary> | |||
[JsonPropertyName("webhooks")] | |||
public Webhook[]? Webhooks { get; init; } // Required property candidate | |||
/// <summary> | |||
/// List of <see cref="User"/>s found in the <see cref="AuditLog"/>. | |||
/// </summary> | |||
[JsonPropertyName("users")] | |||
public User[]? Users { get; init; } // Required property candidate | |||
/// <summary> | |||
/// List of <see cref="AuditLogEntry"/>. | |||
/// </summary> | |||
[JsonPropertyName("audit_log_entries")] | |||
public AuditLogEntry[]? AuditLogEntries { get; init; } // Required property candidate | |||
/// <summary> | |||
/// List of partial <see cref="Integration"/>s. | |||
/// </summary> | |||
[JsonPropertyName("integrations")] | |||
public Integration[]? Integrations { get; init; } // Required property candidate | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord audit log change object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure"/> | |||
/// </remarks> | |||
public record AuditLogChange | |||
{ | |||
/// <summary> | |||
/// New value of the key. | |||
/// </summary> | |||
[JsonPropertyName("new_value")] | |||
public Optional<object> NewValue { get; } | |||
/// <summary> | |||
/// Old value of the key. | |||
/// </summary> | |||
[JsonPropertyName("old_value")] | |||
public Optional<object> OldValue { get; } | |||
/// <summary> | |||
/// Audit log change key that will define the type of value. | |||
/// </summary> | |||
[JsonPropertyName("key")] | |||
public AuditLogChangeKey Key { get; } | |||
} | |||
} |
@@ -0,0 +1,304 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the audit log change key for an <see cref="AuditLogChange"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key"/> | |||
/// </remarks> | |||
public enum AuditLogChangeKey | |||
{ | |||
// | |||
// Any | |||
// | |||
/// <summary> | |||
/// The id of the changed entity - sometimes used in conjunction with other keys. | |||
/// </summary> | |||
Id, | |||
/// <summary> | |||
/// Type of entity created. | |||
/// </summary> | |||
Type, | |||
// | |||
// Guild | |||
// | |||
/// <summary> | |||
/// Name changed. | |||
/// </summary> | |||
Name, | |||
/// <summary> | |||
/// Icon changed. | |||
/// </summary> | |||
IconHash, | |||
/// <summary> | |||
/// Invite splash page artwork changed. | |||
/// </summary> | |||
SplashHash, | |||
/// <summary> | |||
/// Discovery splash changed. | |||
/// </summary> | |||
DiscoverySplashHash, | |||
/// <summary> | |||
/// Guild banner changed. | |||
/// </summary> | |||
BannerHash, | |||
/// <summary> | |||
/// Owner changed. | |||
/// </summary> | |||
OwnerId, | |||
/// <summary> | |||
/// <see cref="VoiceRegion"/> changed. | |||
/// </summary> | |||
Region, | |||
/// <summary> | |||
/// Preferred locale changed. | |||
/// </summary> | |||
PreferredLocale, | |||
/// <summary> | |||
/// Id of the afk <see cref="Channel"/> changed. | |||
/// </summary> | |||
AfkChannelId, | |||
/// <summary> | |||
/// Afk timeout duration changed. | |||
/// </summary> | |||
AfkTimeout, | |||
/// <summary> | |||
/// Id of the rules <see cref="Channel"/> changed. | |||
/// </summary> | |||
RulesChannelId, | |||
/// <summary> | |||
/// Id of the public updates <see cref="Channel"/> changed. | |||
/// </summary> | |||
PublicUpdatesChannelId, | |||
/// <summary> | |||
/// Two-factor auth requirement (<see cref="Models.MfaLevel"/>) changed. | |||
/// </summary> | |||
MfaLevel, | |||
/// <summary> | |||
/// Required <see cref="Models.VerificationLevel"/> changed. | |||
/// </summary> | |||
VerificationLevel, | |||
/// <summary> | |||
/// Change in the <see cref="ExplicitContentFilterLevel"/>, that changes whose | |||
/// <see cref="Message"/>s are scanned and delete for explicit content in the <see cref="Guild"/>. | |||
/// </summary> | |||
ExplicitContentFilter, | |||
/// <summary> | |||
/// Default <see cref="DefaultMessageNotificationLevel"/> changed. | |||
/// </summary> | |||
DefaultMessageNotifications, | |||
/// <summary> | |||
/// <see cref="Guild"/> <see cref="Invite"/> vanity url changed. | |||
/// </summary> | |||
VanityUrlCode, | |||
/// <summary> | |||
/// New <see cref="Role"/> added. | |||
/// </summary> | |||
Add, //TODO: This is actually called $add | |||
/// <summary> | |||
/// <see cref="Role"/> removed. | |||
/// </summary> | |||
Remove, //TODO: This is actually called $remove | |||
/// <summary> | |||
/// Change in number of days after which inactive and <see cref="Role"/>-unassigned <see cref="User"/>s are kicked. | |||
/// </summary> | |||
PruneDeleteDays, | |||
/// <summary> | |||
/// <see cref="GuildWidget"/> enabled/disabled. | |||
/// </summary> | |||
WidgetEnabled, | |||
/// <summary> | |||
/// <see cref="Channel"/> Id of <see cref="GuildWidget"/> changed. | |||
/// </summary> | |||
WidgetChannelId, | |||
/// <summary> | |||
/// Id of the system <see cref="Channel"/> changed. | |||
/// </summary> | |||
SystemChannelId, | |||
// | |||
// Channel | |||
// | |||
/// <summary> | |||
/// Text or voice <see cref="Channel"/> position changed. | |||
/// </summary> | |||
Position, | |||
/// <summary> | |||
/// Text <see cref="Channel"/> topic changed. | |||
/// </summary> | |||
Topic, | |||
/// <summary> | |||
/// Voice <see cref="Channel"/> bitrate changed. | |||
/// </summary> | |||
Bitrate, | |||
/// <summary> | |||
/// <see cref="Overwrite"/>s on a channel changed. | |||
/// </summary> | |||
PermissionOverwrites, | |||
/// <summary> | |||
/// <see cref="Channel"/> nsfw restriction changed. | |||
/// </summary> | |||
Nsfw, | |||
/// <summary> | |||
/// <see cref="Application" /> Id of the added or removed <see cref="Webhook"/> or bot. | |||
/// </summary> | |||
ApplicationId, | |||
// | |||
// Role | |||
// | |||
/// <summary> | |||
/// <see cref="Models.Permissions"/> for a <see cref="Role"/> changed. | |||
/// </summary> | |||
Permissions, | |||
/// <summary> | |||
/// <see cref="Role"/> color changed. | |||
/// </summary> | |||
Color, | |||
/// <summary> | |||
/// <see cref="Role"/> is now displayed/no longer displayed separate from other online <see cref="User"/>s. | |||
/// </summary> | |||
Hoist, | |||
/// <summary> | |||
/// <see cref="Role"/> is now mentionable/unmentionable. | |||
/// </summary> | |||
Mentionable, | |||
/// <summary> | |||
/// A <see cref="Models.Permissions"/> on a <see cref="Channel"/> was allowed for a <see cref="Role"/>. | |||
/// </summary> | |||
Allow, | |||
/// <summary> | |||
/// A <see cref="Models.Permissions"/> on a <see cref="Channel"/> was denied for a <see cref="Role"/>. | |||
/// </summary> | |||
Deny, | |||
// | |||
// Invite | |||
// | |||
/// <summary> | |||
/// <see cref="Invite"/> code changed. | |||
/// </summary> | |||
Code, | |||
/// <summary> | |||
/// <see cref="Channel"/> for <see cref="Invite"/> code changed. | |||
/// </summary> | |||
ChannelId, | |||
/// <summary> | |||
/// <see cref="User"/> who created <see cref="Invite"/> code changed. | |||
/// </summary> | |||
InviterId, | |||
/// <summary> | |||
/// Change to the max number of times <see cref="Invite"/> code can be used. | |||
/// </summary> | |||
MaxUses, | |||
/// <summary> | |||
/// Number of times <see cref="Invite"/> code used changed. | |||
/// </summary> | |||
Uses, | |||
/// <summary> | |||
/// How long <see cref="Invite"/> code lasts changed. | |||
/// </summary> | |||
MaxAge, | |||
/// <summary> | |||
/// <see cref="Invite"/> code is temporary/never expires. | |||
/// </summary> | |||
Temporary, | |||
// | |||
// User | |||
// | |||
/// <summary> | |||
/// <see cref="User"/> server deafened/undeafened. | |||
/// </summary> | |||
Deaf, | |||
/// <summary> | |||
/// <see cref="User"/> server muted/unmuted. | |||
/// </summary> | |||
Mute, | |||
/// <summary> | |||
/// <see cref="User"/> nickname changed. | |||
/// </summary> | |||
Nick, | |||
/// <summary> | |||
/// <see cref="User"/> avatar changed. | |||
/// </summary> | |||
AvatarHash, | |||
// | |||
// Integration | |||
// | |||
/// <summary> | |||
/// <see cref="Integration.EnableEmoticons"/> enabled/disabled. | |||
/// </summary> | |||
EnableEmoticons, | |||
/// <summary> | |||
/// <see cref="Integration.ExpireBehavior"/> changed. | |||
/// </summary> | |||
ExpireBehavior, | |||
/// <summary> | |||
/// <see cref="Integration.ExpireGracePeriod"/> changed. | |||
/// </summary> | |||
ExpireGracePeriod, | |||
// | |||
// Voice channel | |||
// | |||
/// <summary> | |||
/// New user limit in a voice <see cref="Channel"/>. | |||
/// </summary> | |||
UserLimit, | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord audit log entry object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure"/> | |||
/// </remarks> | |||
public record AuditLogEntry | |||
{ | |||
/// <summary> | |||
/// Id of the affected entity (webhook, user, role, etc.). | |||
/// </summary> | |||
[JsonPropertyName("target_id")] | |||
public string? TargetId { get; init; } | |||
/// <summary> | |||
/// Changes made to the <see cref="TargetId"/>. | |||
/// </summary> | |||
[JsonPropertyName("changes")] | |||
public Optional<AuditLogChange[]> Changes { get; init; } | |||
/// <summary> | |||
/// Id of the user who made the changes. | |||
/// </summary> | |||
[JsonPropertyName("user_id")] | |||
public Snowflake? UserId { get; init; } | |||
/// <summary> | |||
/// Id of the entry. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; init; } | |||
/// <summary> | |||
/// Type of action that occurred. | |||
/// </summary> | |||
[JsonPropertyName("action_type")] | |||
public AuditLogEvent ActionType { get; init; } | |||
/// <summary> | |||
/// Additional info for certain action types. | |||
/// </summary> | |||
[JsonPropertyName("options")] | |||
public Optional<OptionalAuditEntryInfo> Options { get; init; } | |||
/// <summary> | |||
/// The reason for the change. | |||
/// </summary> | |||
[JsonPropertyName("reason")] | |||
public Optional<string> Reason { get; init; } | |||
} | |||
} |
@@ -1,152 +1,190 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Specifies the type of audit log event. | |||
/// Declares an enum which represents the audit log event for an <see cref="AuditLogEntry"/>. | |||
/// </summary> | |||
public enum AuditLogEvent : int | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events"/> | |||
/// </remarks> | |||
public enum AuditLogEvent | |||
{ | |||
/// <summary> | |||
/// Default value of this type. | |||
/// Default value of this type. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// The guild was updated. | |||
/// The guild was updated. | |||
/// </summary> | |||
GuildUpdate = 1, | |||
/// <summary> | |||
/// A channel was created. | |||
/// A channel was created. | |||
/// </summary> | |||
ChannelCreate = 10, | |||
/// <summary> | |||
/// A channel was updated. | |||
/// A channel was updated. | |||
/// </summary> | |||
ChannelUpdate = 11, | |||
/// <summary> | |||
/// A channel was deleted. | |||
/// A channel was deleted. | |||
/// </summary> | |||
ChannelDelete = 12, | |||
/// <summary> | |||
/// A channel overwrite was created. | |||
/// A channel overwrite was created. | |||
/// </summary> | |||
ChannelOverwriteCreate = 13, | |||
/// <summary> | |||
/// A channel overwrite was updated. | |||
/// A channel overwrite was updated. | |||
/// </summary> | |||
ChannelOverwriteUpdate = 14, | |||
/// <summary> | |||
/// A channel overwrite was deleted. | |||
/// A channel overwrite was deleted. | |||
/// </summary> | |||
ChannelOverwriteDelete = 15, | |||
/// <summary> | |||
/// A guild member was kicked. | |||
/// A guild member was kicked. | |||
/// </summary> | |||
MemberKick = 20, | |||
/// <summary> | |||
/// A guild member was pruned. | |||
/// A guild member was pruned. | |||
/// </summary> | |||
MemberPrune = 21, | |||
/// <summary> | |||
/// A guild member was banned. | |||
/// A guild member was banned. | |||
/// </summary> | |||
MemberBanAdd = 22, | |||
/// <summary> | |||
/// A guild member was unbanned. | |||
/// A guild member was unbanned. | |||
/// </summary> | |||
MemberBanRemove = 23, | |||
/// <summary> | |||
/// A guild member was updated. | |||
/// A guild member was updated. | |||
/// </summary> | |||
MemberUpdate = 24, | |||
/// <summary> | |||
/// A guild role was updated. | |||
/// A guild role was updated. | |||
/// </summary> | |||
MemberRoleUpdate = 25, | |||
/// <summary> | |||
/// A guild member was moved. | |||
/// A guild member was moved. | |||
/// </summary> | |||
MemberMove = 26, | |||
/// <summary> | |||
/// A guild member was disconnected. | |||
/// A guild member was disconnected. | |||
/// </summary> | |||
MemberDisconnect = 27, | |||
/// <summary> | |||
/// A bot was added. | |||
/// A bot was added. | |||
/// </summary> | |||
BotAdd = 28, | |||
/// <summary> | |||
/// A role was created. | |||
/// A role was created. | |||
/// </summary> | |||
RoleCreate = 30, | |||
/// <summary> | |||
/// A role was updated. | |||
/// A role was updated. | |||
/// </summary> | |||
RoleUpdate = 31, | |||
/// <summary> | |||
/// A role was deleted. | |||
/// A role was deleted. | |||
/// </summary> | |||
RoleDelete = 32, | |||
/// <summary> | |||
/// An invite was created. | |||
/// An invite was created. | |||
/// </summary> | |||
InviteCreate = 40, | |||
/// <summary> | |||
/// An invite was updated. | |||
/// An invite was updated. | |||
/// </summary> | |||
InviteUpdate = 41, | |||
/// <summary> | |||
/// An invite was deleted. | |||
/// An invite was deleted. | |||
/// </summary> | |||
InviteDelete = 42, | |||
/// <summary> | |||
/// A webhook was created. | |||
/// A webhook was created. | |||
/// </summary> | |||
WebhookCreate = 50, | |||
/// <summary> | |||
/// A webhook was updated. | |||
/// A webhook was updated. | |||
/// </summary> | |||
WebhookUpdate = 51, | |||
/// <summary> | |||
/// A webhook was deleted. | |||
/// A webhook was deleted. | |||
/// </summary> | |||
WebhookDelete = 52, | |||
/// <summary> | |||
/// An emoji was created. | |||
/// An emoji was created. | |||
/// </summary> | |||
EmojiCreate = 60, | |||
/// <summary> | |||
/// An emoji was updated. | |||
/// An emoji was updated. | |||
/// </summary> | |||
EmojiUpdate = 61, | |||
/// <summary> | |||
/// An emoji was deleted. | |||
/// An emoji was deleted. | |||
/// </summary> | |||
EmojiDelete = 62, | |||
/// <summary> | |||
/// A message was deleted. | |||
/// A message was deleted. | |||
/// </summary> | |||
MessageDelete = 72, | |||
/// <summary> | |||
/// Message were deleted in bulk. | |||
/// Message were deleted in bulk. | |||
/// </summary> | |||
MessageBulkDelete = 73, | |||
/// <summary> | |||
/// A message was pinned. | |||
/// A message was pinned. | |||
/// </summary> | |||
MessagePin = 74, | |||
/// <summary> | |||
/// A message was unpinned. | |||
/// A message was unpinned. | |||
/// </summary> | |||
MessageUnpin = 75, | |||
/// <summary> | |||
/// An integration was created. | |||
/// An integration was created. | |||
/// </summary> | |||
IntegrationCreate = 80, | |||
/// <summary> | |||
/// An integration was updated. | |||
/// An integration was updated. | |||
/// </summary> | |||
IntegrationUpdate = 81, | |||
/// <summary> | |||
/// An integration was deleted. | |||
/// An integration was deleted. | |||
/// </summary> | |||
IntegrationDelete = 82, | |||
} |
@@ -0,0 +1,90 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord optional audit entry info object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info"/> | |||
/// </remarks> | |||
public record OptionalAuditEntryInfo | |||
{ | |||
/// <summary> | |||
/// Number of days after which inactive members were kicked. | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.MemberPrune"/> | |||
/// </remarks> | |||
[JsonPropertyName("delete_member_days")] | |||
public Optional<int> DeleteMemberDays { get; init; } | |||
/// <summary> | |||
/// Number of members removed by the prune. | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.MemberPrune"/> | |||
/// </remarks> | |||
[JsonPropertyName("members_removed")] | |||
public Optional<int> MembersRemoved { get; init; } | |||
/// <summary> | |||
/// Channel in which the entities were targeted. | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.MemberMove"/>, <see cref="AuditLogEvent.MessagePin"/>, | |||
/// <see cref="AuditLogEvent.MessageUnpin"/>, <see cref="AuditLogEvent.MessageDelete"/> | |||
/// </remarks> | |||
[JsonPropertyName("channel_id")] | |||
public Optional<Snowflake> ChannelId { get; init; } | |||
/// <summary> | |||
/// Id of the message that was targeted. | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.MessagePin"/>, <see cref="AuditLogEvent.MessageUnpin"/> | |||
/// </remarks> | |||
[JsonPropertyName("message_id")] | |||
public Optional<Snowflake> MessageId { get; init; } | |||
/// <summary> | |||
/// Number of entities that were targeted. | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.MessageDelete"/>, <see cref="AuditLogEvent.MessageBulkDelete"/>, | |||
/// <see cref="AuditLogEvent.MemberDisconnect"/>, <see cref="AuditLogEvent.MemberMove"/> | |||
/// </remarks> | |||
[JsonPropertyName("count")] | |||
public Optional<int> Count { get; init; } | |||
/// <summary> | |||
/// Id of the overwritten entity. | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.ChannelOverwriteCreate"/>, <see cref="AuditLogEvent.ChannelOverwriteDelete"/>, | |||
/// <see cref="AuditLogEvent.ChannelOverwriteUpdate"/> | |||
/// </remarks> | |||
[JsonPropertyName("id")] | |||
public Optional<Snowflake> Id { get; init; } | |||
/// <summary> | |||
/// Type of overwritten entity. | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.ChannelOverwriteCreate"/>, <see cref="AuditLogEvent.ChannelOverwriteDelete"/>, | |||
/// <see cref="AuditLogEvent.ChannelOverwriteUpdate"/> | |||
/// </remarks> | |||
[JsonPropertyName("type")] | |||
public Optional<AuditEntryInfoType> Type { get; init; } | |||
/// <summary> | |||
/// Name of the role if type is <see cref="AuditEntryInfoType.Role"/> (not present if type is <see cref="AuditEntryInfoType.GuildMember"/>). | |||
/// </summary> | |||
/// <remarks> | |||
/// Action type: <see cref="AuditLogEvent.ChannelOverwriteCreate"/>, <see cref="AuditLogEvent.ChannelOverwriteDelete"/>, | |||
/// <see cref="AuditLogEvent.ChannelOverwriteUpdate"/> | |||
/// </remarks> | |||
[JsonPropertyName("role_name")] | |||
public Optional<string> RoleName { get; init; } | |||
} | |||
} |
@@ -1,211 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a channel object. | |||
/// </summary> | |||
public record Channel | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Channel"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">The id of this channel.</param> | |||
/// <param name="type">The type of channel.</param> | |||
/// <param name="guildId">The id of the guild (may be missing for some channel objects received over gateway guild dispatches).</param> | |||
/// <param name="position">Sorting position of the channel.</param> | |||
/// <param name="permissionOverwrites">Explicit permission overwrites for members and roles.</param> | |||
/// <param name="name">The name of the channel (2-100 characters).</param> | |||
/// <param name="topic">The channel topic (0-1024 characters).</param> | |||
/// <param name="nsfw">Whether the channel is nsfw.</param> | |||
/// <param name="lastMessageId">The id of the last message sent in this channel (may not point to an existing or valid message).</param> | |||
/// <param name="bitrate">The bitrate (in bits) of the voice channel.</param> | |||
/// <param name="userLimit">The user limit of the voice channel.</param> | |||
/// <param name="rateLimitPerUser">Amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected.</param> | |||
/// <param name="recipients">The recipients of the DM.</param> | |||
/// <param name="icon">Icon hash.</param> | |||
/// <param name="ownerId">Id of the creator of the group DM or thread.</param> | |||
/// <param name="applicationId">Application id of the group DM creator if it is bot-created.</param> | |||
/// <param name="parentId">For guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created.</param> | |||
/// <param name="lastPinTimestamp">When the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.</param> | |||
/// <param name="rtcRegion">Voice region id for the voice channel, automatic when set to null.</param> | |||
/// <param name="videoQualityMode">The camera video quality mode of the voice channel, 1 when not present.</param> | |||
/// <param name="messageCount">An approximate count of messages in a thread, stops counting at 50.</param> | |||
/// <param name="memberCount">An approximate count of users in a thread, stops counting at 50.</param> | |||
/// <param name="threadMetadata">Thread-specific fields not needed by other channels.</param> | |||
/// <param name="member">Thread member object for the current user, if they have joined the thread, only included on certain API endpoints.</param> | |||
[JsonConstructor] | |||
public Channel(Snowflake id, ChannelType type, Optional<Snowflake> guildId, Optional<int> position, Optional<Overwrite[]> permissionOverwrites, Optional<string> name, Optional<string?> topic, Optional<bool> nsfw, Optional<Snowflake?> lastMessageId, Optional<int> bitrate, Optional<int> userLimit, Optional<int> rateLimitPerUser, Optional<User[]> recipients, Optional<string?> icon, Optional<Snowflake> ownerId, Optional<Snowflake> applicationId, Optional<Snowflake?> parentId, Optional<DateTimeOffset?> lastPinTimestamp, Optional<string?> rtcRegion, Optional<VideoQualityMode> videoQualityMode, Optional<int> messageCount, Optional<int> memberCount, Optional<ThreadMetadata> threadMetadata, Optional<ThreadMember> member) | |||
{ | |||
Id = id; | |||
Type = type; | |||
GuildId = guildId; | |||
Position = position; | |||
PermissionOverwrites = permissionOverwrites; | |||
Name = name; | |||
Topic = topic; | |||
Nsfw = nsfw; | |||
LastMessageId = lastMessageId; | |||
Bitrate = bitrate; | |||
UserLimit = userLimit; | |||
RateLimitPerUser = rateLimitPerUser; | |||
Recipients = recipients; | |||
Icon = icon; | |||
OwnerId = ownerId; | |||
ApplicationId = applicationId; | |||
ParentId = parentId; | |||
LastPinTimestamp = lastPinTimestamp; | |||
RtcRegion = rtcRegion; | |||
VideoQualityMode = videoQualityMode; | |||
MessageCount = messageCount; | |||
MemberCount = memberCount; | |||
ThreadMetadata = threadMetadata; | |||
Member = member; | |||
} | |||
/// <summary> | |||
/// The id of this channel. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// The type of channel. | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public ChannelType Type { get; } | |||
/// <summary> | |||
/// The id of the guild (may be missing for some channel objects received over gateway guild dispatches). | |||
/// </summary> | |||
[JsonPropertyName("guild_id")] | |||
public Optional<Snowflake> GuildId { get; } | |||
/// <summary> | |||
/// Sorting position of the channel. | |||
/// </summary> | |||
[JsonPropertyName("position")] | |||
public Optional<int> Position { get; } | |||
/// <summary> | |||
/// Explicit permission overwrites for members and roles. | |||
/// </summary> | |||
[JsonPropertyName("permission_overwrites")] | |||
public Optional<Overwrite[]> PermissionOverwrites { get; } | |||
/// <summary> | |||
/// The name of the channel (2-100 characters). | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public Optional<string> Name { get; } | |||
/// <summary> | |||
/// The channel topic (0-1024 characters). | |||
/// </summary> | |||
[JsonPropertyName("topic")] | |||
public Optional<string?> Topic { get; } | |||
/// <summary> | |||
/// Whether the channel is nsfw. | |||
/// </summary> | |||
[JsonPropertyName("nsfw")] | |||
public Optional<bool> Nsfw { get; } | |||
/// <summary> | |||
/// The id of the last message sent in this channel (may not point to an existing or valid message). | |||
/// </summary> | |||
[JsonPropertyName("last_message_id")] | |||
public Optional<Snowflake?> LastMessageId { get; } | |||
/// <summary> | |||
/// The bitrate (in bits) of the voice channel. | |||
/// </summary> | |||
[JsonPropertyName("bitrate")] | |||
public Optional<int> Bitrate { get; } | |||
/// <summary> | |||
/// The user limit of the voice channel. | |||
/// </summary> | |||
[JsonPropertyName("user_limit")] | |||
public Optional<int> UserLimit { get; } | |||
/// <summary> | |||
/// Amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected. | |||
/// </summary> | |||
[JsonPropertyName("rate_limit_per_user")] | |||
public Optional<int> RateLimitPerUser { get; } | |||
/// <summary> | |||
/// The recipients of the DM. | |||
/// </summary> | |||
[JsonPropertyName("recipients")] | |||
public Optional<User[]> Recipients { get; } | |||
/// <summary> | |||
/// Icon hash. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public Optional<string?> Icon { get; } | |||
/// <summary> | |||
/// Id of the creator of the group DM or thread. | |||
/// </summary> | |||
[JsonPropertyName("owner_id")] | |||
public Optional<Snowflake> OwnerId { get; } | |||
/// <summary> | |||
/// Application id of the group DM creator if it is bot-created. | |||
/// </summary> | |||
[JsonPropertyName("application_id")] | |||
public Optional<Snowflake> ApplicationId { get; } | |||
/// <summary> | |||
/// For guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created. | |||
/// </summary> | |||
[JsonPropertyName("parent_id")] | |||
public Optional<Snowflake?> ParentId { get; } | |||
/// <summary> | |||
/// When the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned. | |||
/// </summary> | |||
[JsonPropertyName("last_pin_timestamp")] | |||
public Optional<DateTimeOffset?> LastPinTimestamp { get; } | |||
/// <summary> | |||
/// Voice region id for the voice channel, automatic when set to null. | |||
/// </summary> | |||
[JsonPropertyName("rtc_region")] | |||
public Optional<string?> RtcRegion { get; } | |||
/// <summary> | |||
/// The camera video quality mode of the voice channel, 1 when not present. | |||
/// </summary> | |||
[JsonPropertyName("video_quality_mode")] | |||
public Optional<VideoQualityMode> VideoQualityMode { get; } | |||
/// <summary> | |||
/// An approximate count of messages in a thread, stops counting at 50. | |||
/// </summary> | |||
[JsonPropertyName("message_count")] | |||
public Optional<int> MessageCount { get; } | |||
/// <summary> | |||
/// An approximate count of users in a thread, stops counting at 50. | |||
/// </summary> | |||
[JsonPropertyName("member_count")] | |||
public Optional<int> MemberCount { get; } | |||
/// <summary> | |||
/// Thread-specific fields not needed by other channels. | |||
/// </summary> | |||
[JsonPropertyName("thread_metadata")] | |||
public Optional<ThreadMetadata> ThreadMetadata { get; } | |||
/// <summary> | |||
/// Thread member object for the current user, if they have joined the thread, only included on certain API endpoints. | |||
/// </summary> | |||
[JsonPropertyName("member")] | |||
public Optional<ThreadMember> Member { get; } | |||
} | |||
} |
@@ -1,66 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the channel type. | |||
/// </summary> | |||
[Flags] | |||
public enum ChannelType | |||
{ | |||
/// <summary> | |||
/// A text channel within a server. | |||
/// </summary> | |||
GuildText = 0, | |||
/// <summary> | |||
/// A direct message between users. | |||
/// </summary> | |||
Dm = 1, | |||
/// <summary> | |||
/// A voice channel within a server. | |||
/// </summary> | |||
GuildVoice = 2, | |||
/// <summary> | |||
/// A direct message between multiple users. | |||
/// </summary> | |||
GroupDm = 3, | |||
/// <summary> | |||
/// An organizational category that contains up to 50 channels. | |||
/// </summary> | |||
GuildCategory = 4, | |||
/// <summary> | |||
/// A channel that users can follow and crosspost into their own server. | |||
/// </summary> | |||
GuildNews = 5, | |||
/// <summary> | |||
/// A channel in which game developers can sell their game on Discord. | |||
/// </summary> | |||
GuildStore = 6, | |||
/// <summary> | |||
/// A temporary sub-channel within a GUILD_NEWS channel. | |||
/// </summary> | |||
GuildNewsThread = 10, | |||
/// <summary> | |||
/// A temporary sub-channel within a GUILD_TEXT channel. | |||
/// </summary> | |||
GuildPublicThread = 11, | |||
/// <summary> | |||
/// A temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission. | |||
/// </summary> | |||
GuildPrivateThread = 12, | |||
/// <summary> | |||
/// A voice channel for hosting events with an audience. | |||
/// </summary> | |||
GuildStageVoice = 13, | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a followed channel object. | |||
/// </summary> | |||
public record FollowedChannel | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="FollowedChannel"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="channelId">Source channel id.</param> | |||
/// <param name="webhookId">Created target webhook id.</param> | |||
[JsonConstructor] | |||
public FollowedChannel(Snowflake channelId, Snowflake webhookId) | |||
{ | |||
ChannelId = channelId; | |||
WebhookId = webhookId; | |||
} | |||
/// <summary> | |||
/// Source channel id. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake ChannelId { get; } | |||
/// <summary> | |||
/// Created target webhook id. | |||
/// </summary> | |||
[JsonPropertyName("webhook_id")] | |||
public Snowflake WebhookId { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents an allowed mentions object. | |||
/// </summary> | |||
public record AllowedMentions | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="AllowedMentions"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="parse">An array of allowed mention types to parse from the content.</param> | |||
/// <param name="roles">Array of role_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> | |||
[JsonConstructor] | |||
public AllowedMentions(string[] parse, Snowflake[] roles, Snowflake[] users, bool repliedUser) | |||
{ | |||
Parse = parse; | |||
Roles = roles; | |||
Users = users; | |||
RepliedUser = repliedUser; | |||
} | |||
/// <summary> | |||
/// An array of allowed mention types to parse from the content. | |||
/// </summary> | |||
[JsonPropertyName("parse")] | |||
public string[] Parse { get; } | |||
/// <summary> | |||
/// Array of role_ids to mention (Max size of 100). | |||
/// </summary> | |||
[JsonPropertyName("roles")] | |||
public Snowflake[] Roles { get; } | |||
/// <summary> | |||
/// Array of user_ids to mention (Max size of 100). | |||
/// </summary> | |||
[JsonPropertyName("users")] | |||
public Snowflake[] Users { get; } | |||
/// <summary> | |||
/// For replies, whether to mention the author of the message being replied to (default false). | |||
/// </summary> | |||
[JsonPropertyName("replied_user")] | |||
public bool RepliedUser { get; } | |||
} | |||
} |
@@ -1,82 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents an attachment object. | |||
/// </summary> | |||
public record Attachment | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Attachment"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Attachment id.</param> | |||
/// <param name="filename">Name of file attached.</param> | |||
/// <param name="contentType">The attachment's media type.</param> | |||
/// <param name="size">Size of file in bytes.</param> | |||
/// <param name="url">Source url of file.</param> | |||
/// <param name="proxyUrl">A proxied url of file.</param> | |||
/// <param name="height">Height of file (if image).</param> | |||
/// <param name="width">Width of file (if image).</param> | |||
[JsonConstructor] | |||
public Attachment(Snowflake id, string filename, Optional<string> contentType, int size, string url, string proxyUrl, Optional<int?> height, Optional<int?> width) | |||
{ | |||
Id = id; | |||
Filename = filename; | |||
ContentType = contentType; | |||
Size = size; | |||
Url = url; | |||
ProxyUrl = proxyUrl; | |||
Height = height; | |||
Width = width; | |||
} | |||
/// <summary> | |||
/// Attachment id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Name of file attached. | |||
/// </summary> | |||
[JsonPropertyName("filename")] | |||
public string Filename { get; } | |||
/// <summary> | |||
/// The attachment's media type. | |||
/// </summary> | |||
[JsonPropertyName("content_type")] | |||
public Optional<string> ContentType { get; } | |||
/// <summary> | |||
/// Size of file in bytes. | |||
/// </summary> | |||
[JsonPropertyName("size")] | |||
public int Size { get; } | |||
/// <summary> | |||
/// Source url of file. | |||
/// </summary> | |||
[JsonPropertyName("url")] | |||
public string Url { get; } | |||
/// <summary> | |||
/// A proxied url of file. | |||
/// </summary> | |||
[JsonPropertyName("proxy_url")] | |||
public string ProxyUrl { get; } | |||
/// <summary> | |||
/// Height of file (if image). | |||
/// </summary> | |||
[JsonPropertyName("height")] | |||
public Optional<int?> Height { get; } | |||
/// <summary> | |||
/// Width of file (if image). | |||
/// </summary> | |||
[JsonPropertyName("width")] | |||
public Optional<int?> Width { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a channel mention object. | |||
/// </summary> | |||
public record ChannelMention | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="ChannelMention"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Id of the channel.</param> | |||
/// <param name="guildId">Id of the guild containing the channel.</param> | |||
/// <param name="type">The type of channel.</param> | |||
/// <param name="name">The name of the channel.</param> | |||
[JsonConstructor] | |||
public ChannelMention(Snowflake id, Snowflake guildId, ChannelType type, string name) | |||
{ | |||
Id = id; | |||
GuildId = guildId; | |||
Type = type; | |||
Name = name; | |||
} | |||
/// <summary> | |||
/// Id of the channel. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Id of the guild containing the channel. | |||
/// </summary> | |||
[JsonPropertyName("guild_id")] | |||
public Snowflake GuildId { get; } | |||
/// <summary> | |||
/// The type of channel. | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public ChannelType Type { get; } | |||
/// <summary> | |||
/// The name of the channel. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
} | |||
} |
@@ -1,123 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed object. | |||
/// </summary> | |||
public record Embed | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Embed"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="title">Title of embed.</param> | |||
/// <param name="type">Type of embed (always "rich" for webhook embeds).</param> | |||
/// <param name="description">Description of embed.</param> | |||
/// <param name="url">Url of embed.</param> | |||
/// <param name="timestamp">Timestamp of embed content.</param> | |||
/// <param name="color">Color code of the embed.</param> | |||
/// <param name="footer">Footer information.</param> | |||
/// <param name="image">Image information.</param> | |||
/// <param name="thumbnail">Thumbnail information.</param> | |||
/// <param name="video">Video information.</param> | |||
/// <param name="provider">Provider information.</param> | |||
/// <param name="author">Author information.</param> | |||
/// <param name="fields">Fields information.</param> | |||
[JsonConstructor] | |||
public Embed(Optional<string> title, Optional<EmbedType> type, Optional<string> description, Optional<string> url, Optional<DateTimeOffset> timestamp, Optional<int> color, Optional<EmbedFooter> footer, Optional<EmbedImage> image, Optional<EmbedThumbnail> thumbnail, Optional<EmbedVideo> video, Optional<EmbedProvider> provider, Optional<EmbedAuthor> author, Optional<EmbedField[]> fields) | |||
{ | |||
Title = title; | |||
Type = type; | |||
Description = description; | |||
Url = url; | |||
Timestamp = timestamp; | |||
Color = color; | |||
Footer = footer; | |||
Image = image; | |||
Thumbnail = thumbnail; | |||
Video = video; | |||
Provider = provider; | |||
Author = author; | |||
Fields = fields; | |||
} | |||
/// <summary> | |||
/// Title of embed. | |||
/// </summary> | |||
[JsonPropertyName("title")] | |||
public Optional<string> Title { get; } | |||
/// <summary> | |||
/// Type of embed (always "rich" for webhook embeds). | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public Optional<EmbedType> Type { get; } | |||
/// <summary> | |||
/// Description of embed. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public Optional<string> Description { get; } | |||
/// <summary> | |||
/// Url of embed. | |||
/// </summary> | |||
[JsonPropertyName("url")] | |||
public Optional<string> Url { get; } | |||
/// <summary> | |||
/// Timestamp of embed content. | |||
/// </summary> | |||
[JsonPropertyName("timestamp")] | |||
public Optional<DateTimeOffset> Timestamp { get; } | |||
/// <summary> | |||
/// Color code of the embed. | |||
/// </summary> | |||
[JsonPropertyName("color")] | |||
public Optional<int> Color { get; } | |||
/// <summary> | |||
/// Footer information. | |||
/// </summary> | |||
[JsonPropertyName("footer")] | |||
public Optional<EmbedFooter> Footer { get; } | |||
/// <summary> | |||
/// Image information. | |||
/// </summary> | |||
[JsonPropertyName("image")] | |||
public Optional<EmbedImage> Image { get; } | |||
/// <summary> | |||
/// Thumbnail information. | |||
/// </summary> | |||
[JsonPropertyName("thumbnail")] | |||
public Optional<EmbedThumbnail> Thumbnail { get; } | |||
/// <summary> | |||
/// Video information. | |||
/// </summary> | |||
[JsonPropertyName("video")] | |||
public Optional<EmbedVideo> Video { get; } | |||
/// <summary> | |||
/// Provider information. | |||
/// </summary> | |||
[JsonPropertyName("provider")] | |||
public Optional<EmbedProvider> Provider { get; } | |||
/// <summary> | |||
/// Author information. | |||
/// </summary> | |||
[JsonPropertyName("author")] | |||
public Optional<EmbedAuthor> Author { get; } | |||
/// <summary> | |||
/// Fields information. | |||
/// </summary> | |||
[JsonPropertyName("fields")] | |||
public Optional<EmbedField[]> Fields { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed author object. | |||
/// </summary> | |||
public record EmbedAuthor | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="EmbedAuthor"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="name">Name of author.</param> | |||
/// <param name="url">Url of author.</param> | |||
/// <param name="iconUrl">Url of author icon (only supports http(s) and attachments).</param> | |||
/// <param name="proxyIconUrl">A proxied url of author icon.</param> | |||
[JsonConstructor] | |||
public EmbedAuthor(Optional<string> name, Optional<string> url, Optional<string> iconUrl, Optional<string> proxyIconUrl) | |||
{ | |||
Name = name; | |||
Url = url; | |||
IconUrl = iconUrl; | |||
ProxyIconUrl = proxyIconUrl; | |||
} | |||
/// <summary> | |||
/// Name of author. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public Optional<string> Name { get; } | |||
/// <summary> | |||
/// Url of author. | |||
/// </summary> | |||
[JsonPropertyName("url")] | |||
public Optional<string> Url { get; } | |||
/// <summary> | |||
/// Url of author icon (only supports http(s) and attachments). | |||
/// </summary> | |||
[JsonPropertyName("icon_url")] | |||
public Optional<string> IconUrl { get; } | |||
/// <summary> | |||
/// A proxied url of author icon. | |||
/// </summary> | |||
[JsonPropertyName("proxy_icon_url")] | |||
public Optional<string> ProxyIconUrl { get; } | |||
} | |||
} |
@@ -1,42 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed field object. | |||
/// </summary> | |||
public record EmbedField | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="EmbedField"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="name">Name of the field.</param> | |||
/// <param name="value">Value of the field.</param> | |||
/// <param name="inline">Whether or not this field should display inline.</param> | |||
[JsonConstructor] | |||
public EmbedField(string name, string value, Optional<bool> inline) | |||
{ | |||
Name = name; | |||
Value = value; | |||
Inline = inline; | |||
} | |||
/// <summary> | |||
/// Name of the field. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// Value of the field. | |||
/// </summary> | |||
[JsonPropertyName("value")] | |||
public string Value { get; } | |||
/// <summary> | |||
/// Whether or not this field should display inline. | |||
/// </summary> | |||
[JsonPropertyName("inline")] | |||
public Optional<bool> Inline { get; } | |||
} | |||
} |
@@ -1,42 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed footer object. | |||
/// </summary> | |||
public record EmbedFooter | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="EmbedFooter"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="text">Footer text.</param> | |||
/// <param name="iconUrl">Url of footer icon (only supports http(s) and attachments).</param> | |||
/// <param name="proxyIconUrl">A proxied url of footer icon.</param> | |||
[JsonConstructor] | |||
public EmbedFooter(string text, Optional<string> iconUrl, Optional<string> proxyIconUrl) | |||
{ | |||
Text = text; | |||
IconUrl = iconUrl; | |||
ProxyIconUrl = proxyIconUrl; | |||
} | |||
/// <summary> | |||
/// Footer text. | |||
/// </summary> | |||
[JsonPropertyName("text")] | |||
public string Text { get; } | |||
/// <summary> | |||
/// Url of footer icon (only supports http(s) and attachments). | |||
/// </summary> | |||
[JsonPropertyName("icon_url")] | |||
public Optional<string> IconUrl { get; } | |||
/// <summary> | |||
/// A proxied url of footer icon. | |||
/// </summary> | |||
[JsonPropertyName("proxy_icon_url")] | |||
public Optional<string> ProxyIconUrl { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed image object. | |||
/// </summary> | |||
public record EmbedImage | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="EmbedImage"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="url">Source url of image (only supports http(s) and attachments).</param> | |||
/// <param name="proxyUrl">A proxied url of the image.</param> | |||
/// <param name="height">Height of image.</param> | |||
/// <param name="width">Width of image.</param> | |||
[JsonConstructor] | |||
public EmbedImage(Optional<string> url, Optional<string> proxyUrl, Optional<int> height, Optional<int> width) | |||
{ | |||
Url = url; | |||
ProxyUrl = proxyUrl; | |||
Height = height; | |||
Width = width; | |||
} | |||
/// <summary> | |||
/// Source url of image (only supports http(s) and attachments). | |||
/// </summary> | |||
[JsonPropertyName("url")] | |||
public Optional<string> Url { get; } | |||
/// <summary> | |||
/// A proxied url of the image. | |||
/// </summary> | |||
[JsonPropertyName("proxy_url")] | |||
public Optional<string> ProxyUrl { get; } | |||
/// <summary> | |||
/// Height of image. | |||
/// </summary> | |||
[JsonPropertyName("height")] | |||
public Optional<int> Height { get; } | |||
/// <summary> | |||
/// Width of image. | |||
/// </summary> | |||
[JsonPropertyName("width")] | |||
public Optional<int> Width { get; } | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed provider object. | |||
/// </summary> | |||
public record EmbedProvider | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="EmbedProvider"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="name">Name of provider.</param> | |||
/// <param name="url">Url of provider.</param> | |||
[JsonConstructor] | |||
public EmbedProvider(Optional<string> name, Optional<string> url) | |||
{ | |||
Name = name; | |||
Url = url; | |||
} | |||
/// <summary> | |||
/// Name of provider. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public Optional<string> Name { get; } | |||
/// <summary> | |||
/// Url of provider. | |||
/// </summary> | |||
[JsonPropertyName("url")] | |||
public Optional<string> Url { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed thumbnail object. | |||
/// </summary> | |||
public record EmbedThumbnail | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="EmbedThumbnail"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="url">Source url of thumbnail (only supports http(s) and attachments).</param> | |||
/// <param name="proxyUrl">A proxied url of the thumbnail.</param> | |||
/// <param name="height">Height of thumbnail.</param> | |||
/// <param name="width">Width of thumbnail.</param> | |||
[JsonConstructor] | |||
public EmbedThumbnail(Optional<string> url, Optional<string> proxyUrl, Optional<int> height, Optional<int> width) | |||
{ | |||
Url = url; | |||
ProxyUrl = proxyUrl; | |||
Height = height; | |||
Width = width; | |||
} | |||
/// <summary> | |||
/// Source url of thumbnail (only supports http(s) and attachments). | |||
/// </summary> | |||
[JsonPropertyName("url")] | |||
public Optional<string> Url { get; } | |||
/// <summary> | |||
/// A proxied url of the thumbnail. | |||
/// </summary> | |||
[JsonPropertyName("proxy_url")] | |||
public Optional<string> ProxyUrl { get; } | |||
/// <summary> | |||
/// Height of thumbnail. | |||
/// </summary> | |||
[JsonPropertyName("height")] | |||
public Optional<int> Height { get; } | |||
/// <summary> | |||
/// Width of thumbnail. | |||
/// </summary> | |||
[JsonPropertyName("width")] | |||
public Optional<int> Width { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a embed video object. | |||
/// </summary> | |||
public record EmbedVideo | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="EmbedVideo"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="url">Source url of video.</param> | |||
/// <param name="proxyUrl">A proxied url of the video.</param> | |||
/// <param name="height">Height of video.</param> | |||
/// <param name="width">Width of video.</param> | |||
[JsonConstructor] | |||
public EmbedVideo(Optional<string> url, Optional<string> proxyUrl, Optional<int> height, Optional<int> width) | |||
{ | |||
Url = url; | |||
ProxyUrl = proxyUrl; | |||
Height = height; | |||
Width = width; | |||
} | |||
/// <summary> | |||
/// Source url of video. | |||
/// </summary> | |||
[JsonPropertyName("url")] | |||
public Optional<string> Url { get; } | |||
/// <summary> | |||
/// A proxied url of the video. | |||
/// </summary> | |||
[JsonPropertyName("proxy_url")] | |||
public Optional<string> ProxyUrl { get; } | |||
/// <summary> | |||
/// Height of video. | |||
/// </summary> | |||
[JsonPropertyName("height")] | |||
public Optional<int> Height { get; } | |||
/// <summary> | |||
/// Width of video. | |||
/// </summary> | |||
[JsonPropertyName("width")] | |||
public Optional<int> Width { get; } | |||
} | |||
} |
@@ -1,259 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a message object. | |||
/// </summary> | |||
public record Message | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Message"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Id of the message.</param> | |||
/// <param name="channelId">Id of the channel the message was sent in.</param> | |||
/// <param name="guildId">Id of the guild the message was sent in.</param> | |||
/// <param name="author">The author of this message (not guaranteed to be a valid user, see below).</param> | |||
/// <param name="member">Member properties for this message's author.</param> | |||
/// <param name="content">Contents of the message.</param> | |||
/// <param name="timestamp">When this message was sent.</param> | |||
/// <param name="editedTimestamp">When this message was edited (or null if never).</param> | |||
/// <param name="tts">Whether this was a TTS message.</param> | |||
/// <param name="mentionEveryone">Whether this message mentions everyone.</param> | |||
/// <param name="mentions">Users specifically mentioned in the message.</param> | |||
/// <param name="mentionRoles">Roles specifically mentioned in this message.</param> | |||
/// <param name="mentionChannels">Channels specifically mentioned in this message.</param> | |||
/// <param name="attachments">Any attached files.</param> | |||
/// <param name="embeds">Any embedded content.</param> | |||
/// <param name="reactions">Reactions to the message.</param> | |||
/// <param name="nonce">Used for validating a message was sent.</param> | |||
/// <param name="pinned">Whether this message is pinned.</param> | |||
/// <param name="webhookId">If the message is generated by a webhook, this is the webhook's id.</param> | |||
/// <param name="type">Type of message.</param> | |||
/// <param name="activity">Sent with Rich Presence-related chat embeds.</param> | |||
/// <param name="application">Sent with Rich Presence-related chat embeds.</param> | |||
/// <param name="applicationId">If the message is a response to an Interaction, this is the id of the interaction's application.</param> | |||
/// <param name="messageReference">Data showing the source of a crosspost, channel follow add, pin, or reply message.</param> | |||
/// <param name="flags">Message flags combined as a bitfield.</param> | |||
/// <param name="stickers">The stickers sent with the message (bots currently can only receive messages with stickers, not send).</param> | |||
/// <param name="referencedMessage">The message associated with the message_reference.</param> | |||
/// <param name="interaction">Sent if the message is a response to an Interaction.</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> | |||
[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, 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<ActionRowComponent[]> components) | |||
{ | |||
Id = id; | |||
ChannelId = channelId; | |||
GuildId = guildId; | |||
Author = author; | |||
Member = member; | |||
Content = content; | |||
Timestamp = timestamp; | |||
EditedTimestamp = editedTimestamp; | |||
Tts = tts; | |||
MentionEveryone = mentionEveryone; | |||
Mentions = mentions; | |||
MentionRoles = mentionRoles; | |||
MentionChannels = mentionChannels; | |||
Attachments = attachments; | |||
Embeds = embeds; | |||
Reactions = reactions; | |||
Nonce = nonce; | |||
Pinned = pinned; | |||
WebhookId = webhookId; | |||
Type = type; | |||
Activity = activity; | |||
Application = application; | |||
ApplicationId = applicationId; | |||
MessageReference = messageReference; | |||
Flags = flags; | |||
Stickers = stickers; | |||
ReferencedMessage = referencedMessage; | |||
Interaction = interaction; | |||
Thread = thread; | |||
Components = components; | |||
} | |||
/// <summary> | |||
/// Id of the message. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Id of the channel the message was sent in. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake ChannelId { get; } | |||
/// <summary> | |||
/// Id of the guild the message was sent in. | |||
/// </summary> | |||
[JsonPropertyName("guild_id")] | |||
public Optional<Snowflake> GuildId { get; } | |||
/// <summary> | |||
/// The author of this message (not guaranteed to be a valid user, see below). | |||
/// </summary> | |||
[JsonPropertyName("author")] | |||
public User Author { get; } | |||
/// <summary> | |||
/// Member properties for this message's author. | |||
/// </summary> | |||
[JsonPropertyName("member")] | |||
public Optional<GuildMember> Member { get; } | |||
/// <summary> | |||
/// Contents of the message. | |||
/// </summary> | |||
[JsonPropertyName("content")] | |||
public string Content { get; } | |||
/// <summary> | |||
/// When this message was sent. | |||
/// </summary> | |||
[JsonPropertyName("timestamp")] | |||
public DateTimeOffset Timestamp { get; } | |||
/// <summary> | |||
/// When this message was edited (or null if never). | |||
/// </summary> | |||
[JsonPropertyName("edited_timestamp")] | |||
public DateTimeOffset? EditedTimestamp { get; } | |||
/// <summary> | |||
/// Whether this was a TTS message. | |||
/// </summary> | |||
[JsonPropertyName("tts")] | |||
public bool Tts { get; } | |||
/// <summary> | |||
/// Whether this message mentions everyone. | |||
/// </summary> | |||
[JsonPropertyName("mention_everyone")] | |||
public bool MentionEveryone { get; } | |||
/// <summary> | |||
/// Users specifically mentioned in the message. | |||
/// </summary> | |||
[JsonPropertyName("mentions")] | |||
public UserMention[] Mentions { get; } | |||
/// <summary> | |||
/// Roles specifically mentioned in this message. | |||
/// </summary> | |||
[JsonPropertyName("mention_roles")] | |||
public Snowflake[] MentionRoles { get; } | |||
/// <summary> | |||
/// Channels specifically mentioned in this message. | |||
/// </summary> | |||
[JsonPropertyName("mention_channels")] | |||
public Optional<ChannelMention[]> MentionChannels { get; } | |||
/// <summary> | |||
/// Any attached files. | |||
/// </summary> | |||
[JsonPropertyName("attachments")] | |||
public Attachment[] Attachments { get; } | |||
/// <summary> | |||
/// Any embedded content. | |||
/// </summary> | |||
[JsonPropertyName("embeds")] | |||
public Embed[] Embeds { get; } | |||
/// <summary> | |||
/// Reactions to the message. | |||
/// </summary> | |||
[JsonPropertyName("reactions")] | |||
public Optional<Reaction[]> Reactions { get; } | |||
/// <summary> | |||
/// Used for validating a message was sent. | |||
/// </summary> | |||
[JsonPropertyName("nonce")] | |||
public Optional<string> Nonce { get; } | |||
/// <summary> | |||
/// Whether this message is pinned. | |||
/// </summary> | |||
[JsonPropertyName("pinned")] | |||
public bool Pinned { get; } | |||
/// <summary> | |||
/// If the message is generated by a webhook, this is the webhook's id. | |||
/// </summary> | |||
[JsonPropertyName("webhook_id")] | |||
public Optional<Snowflake> WebhookId { get; } | |||
/// <summary> | |||
/// Type of message. | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public int Type { get; } | |||
/// <summary> | |||
/// Sent with Rich Presence-related chat embeds. | |||
/// </summary> | |||
[JsonPropertyName("activity")] | |||
public Optional<MessageActivity> Activity { get; } | |||
/// <summary> | |||
/// Sent with Rich Presence-related chat embeds. | |||
/// </summary> | |||
[JsonPropertyName("application")] | |||
public Optional<Application> Application { get; } | |||
/// <summary> | |||
/// If the message is a response to an Interaction, this is the id of the interaction's application. | |||
/// </summary> | |||
[JsonPropertyName("application_id")] | |||
public Optional<Snowflake> ApplicationId { get; } | |||
/// <summary> | |||
/// Data showing the source of a crosspost, channel follow add, pin, or reply message. | |||
/// </summary> | |||
[JsonPropertyName("message_reference")] | |||
public Optional<MessageReference> MessageReference { get; } | |||
/// <summary> | |||
/// Message flags combined as a bitfield. | |||
/// </summary> | |||
[JsonPropertyName("flags")] | |||
public Optional<MessageFlags> Flags { get; } | |||
/// <summary> | |||
/// The stickers sent with the message (bots currently can only receive messages with stickers, not send). | |||
/// </summary> | |||
[JsonPropertyName("stickers")] | |||
public Optional<Sticker[]> Stickers { get; } | |||
/// <summary> | |||
/// The message associated with the message_reference. | |||
/// </summary> | |||
[JsonPropertyName("referenced_message")] | |||
public Optional<Message?> ReferencedMessage { get; } | |||
/// <summary> | |||
/// Sent if the message is a response to an Interaction. | |||
/// </summary> | |||
[JsonPropertyName("interaction")] | |||
public Optional<MessageInteraction> Interaction { get; } | |||
/// <summary> | |||
/// The thread that was started from this message, includes thread member object. | |||
/// </summary> | |||
[JsonPropertyName("thread")] | |||
public Optional<Channel> Thread { get; } | |||
/// <summary> | |||
/// Sent if the message contains components like buttons, action rows, or other interactive components. | |||
/// </summary> | |||
[JsonPropertyName("components")] | |||
public Optional<ActionRowComponent[]> Components { get; } | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a message activity object. | |||
/// </summary> | |||
public record MessageActivity | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="MessageActivity"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="type">Type of message activity.</param> | |||
/// <param name="partyId">Party_id from a Rich Presence event.</param> | |||
[JsonConstructor] | |||
public MessageActivity(int type, Optional<string> partyId) | |||
{ | |||
Type = type; | |||
PartyId = partyId; | |||
} | |||
/// <summary> | |||
/// Type of message activity. | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public int Type { get; } | |||
/// <summary> | |||
/// Party_id from a Rich Presence event. | |||
/// </summary> | |||
[JsonPropertyName("party_id")] | |||
public Optional<string> PartyId { get; } | |||
} | |||
} |
@@ -1,31 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the message activity type. | |||
/// </summary> | |||
[Flags] | |||
public enum MessageActivityType | |||
{ | |||
/// <summary> | |||
/// The message activity is to join. | |||
/// </summary> | |||
Join = 1, | |||
/// <summary> | |||
/// The message activity is to spectate a stream. | |||
/// </summary> | |||
Spectate = 2, | |||
/// <summary> | |||
/// The message activity is to listen to music. | |||
/// </summary> | |||
Listen = 3, | |||
/// <summary> | |||
/// The message activity is to request to join. | |||
/// </summary> | |||
JoinRequest = 5, | |||
} | |||
} |
@@ -1,51 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the message flags. | |||
/// </summary> | |||
[Flags] | |||
public enum MessageFlags | |||
{ | |||
/// <summary> | |||
/// This message has been published to subscribed channels (via Channel Following). | |||
/// </summary> | |||
Crossposted = 1 << 0, | |||
/// <summary> | |||
/// This message originated from a message in another channel (via Channel Following). | |||
/// </summary> | |||
IsCrosspost = 1 << 1, | |||
/// <summary> | |||
/// Do not include any embeds when serializing this message. | |||
/// </summary> | |||
SuppressEmbeds = 1 << 2, | |||
/// <summary> | |||
/// The source message for this crosspost has been deleted (via Channel Following). | |||
/// </summary> | |||
SourceMessageDeleted = 1 << 3, | |||
/// <summary> | |||
/// This message came from the urgent message system. | |||
/// </summary> | |||
Urgent = 1 << 4, | |||
/// <summary> | |||
/// This message has an associated thread, with the same id as the message. | |||
/// </summary> | |||
HasThread = 1 << 5, | |||
/// <summary> | |||
/// This message is only visible to the user who invoked the Interaction. | |||
/// </summary> | |||
Ephemeral = 1 << 6, | |||
/// <summary> | |||
/// This message is an Interaction Response and the bot is "thinking". | |||
/// </summary> | |||
Loading = 1 << 7, | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a message reference object. | |||
/// </summary> | |||
public record MessageReference | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="MessageReference"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="messageId">Id of the originating message.</param> | |||
/// <param name="channelId">Id of the originating message's channel.</param> | |||
/// <param name="guildId">Id of the originating message's guild.</param> | |||
/// <param name="failIfNotExists">When sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true.</param> | |||
[JsonConstructor] | |||
public MessageReference(Optional<Snowflake> messageId, Optional<Snowflake> channelId, Optional<Snowflake> guildId, Optional<bool> failIfNotExists) | |||
{ | |||
MessageId = messageId; | |||
ChannelId = channelId; | |||
GuildId = guildId; | |||
FailIfNotExists = failIfNotExists; | |||
} | |||
/// <summary> | |||
/// Id of the originating message. | |||
/// </summary> | |||
[JsonPropertyName("message_id")] | |||
public Optional<Snowflake> MessageId { get; } | |||
/// <summary> | |||
/// Id of the originating message's channel. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Optional<Snowflake> ChannelId { get; } | |||
/// <summary> | |||
/// Id of the originating message's guild. | |||
/// </summary> | |||
[JsonPropertyName("guild_id")] | |||
public Optional<Snowflake> GuildId { get; } | |||
/// <summary> | |||
/// When sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true. | |||
/// </summary> | |||
[JsonPropertyName("fail_if_not_exists")] | |||
public Optional<bool> FailIfNotExists { get; } | |||
} | |||
} |
@@ -1,42 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a reaction object. | |||
/// </summary> | |||
public record Reaction | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Reaction"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="count">Times this emoji has been used to react.</param> | |||
/// <param name="me">Whether the current user reacted using this emoji.</param> | |||
/// <param name="emoji">Emoji information.</param> | |||
[JsonConstructor] | |||
public Reaction(int count, bool me, Emoji emoji) | |||
{ | |||
Count = count; | |||
Me = me; | |||
Emoji = emoji; | |||
} | |||
/// <summary> | |||
/// Times this emoji has been used to react. | |||
/// </summary> | |||
[JsonPropertyName("count")] | |||
public int Count { get; } | |||
/// <summary> | |||
/// Whether the current user reacted using this emoji. | |||
/// </summary> | |||
[JsonPropertyName("me")] | |||
public bool Me { get; } | |||
/// <summary> | |||
/// Emoji information. | |||
/// </summary> | |||
[JsonPropertyName("emoji")] | |||
public Emoji Emoji { get; } | |||
} | |||
} |
@@ -1,74 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a sticker object. | |||
/// </summary> | |||
public record Sticker | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Sticker"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Id of the sticker.</param> | |||
/// <param name="packId">Id of the pack the sticker is from.</param> | |||
/// <param name="name">Name of the sticker.</param> | |||
/// <param name="description">Description of the sticker.</param> | |||
/// <param name="tags">A comma-separated list of tags for the sticker.</param> | |||
/// <param name="asset">Sticker asset hash.</param> | |||
/// <param name="formatType">Type of sticker format.</param> | |||
[JsonConstructor] | |||
public Sticker(Snowflake id, Snowflake packId, string name, string description, Optional<string> tags, string asset, StickerFormatType formatType) | |||
{ | |||
Id = id; | |||
PackId = packId; | |||
Name = name; | |||
Description = description; | |||
Tags = tags; | |||
Asset = asset; | |||
FormatType = formatType; | |||
} | |||
/// <summary> | |||
/// Id of the sticker. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Id of the pack the sticker is from. | |||
/// </summary> | |||
[JsonPropertyName("pack_id")] | |||
public Snowflake PackId { get; } | |||
/// <summary> | |||
/// Name of the sticker. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// Description of the sticker. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string Description { get; } | |||
/// <summary> | |||
/// A comma-separated list of tags for the sticker. | |||
/// </summary> | |||
[JsonPropertyName("tags")] | |||
public Optional<string> Tags { get; } | |||
/// <summary> | |||
/// Sticker asset hash. | |||
/// </summary> | |||
[JsonPropertyName("asset")] | |||
public string Asset { get; } | |||
/// <summary> | |||
/// Type of sticker format. | |||
/// </summary> | |||
[JsonPropertyName("format_type")] | |||
public StickerFormatType FormatType { get; } | |||
} | |||
} |
@@ -1,26 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the sticker format type. | |||
/// </summary> | |||
[Flags] | |||
public enum StickerFormatType | |||
{ | |||
/// <summary> | |||
/// The sticker format is a png. | |||
/// </summary> | |||
Png = 1, | |||
/// <summary> | |||
/// The sticker format is a apng. | |||
/// </summary> | |||
Apng = 2, | |||
/// <summary> | |||
/// The sticker format is a lottie. | |||
/// </summary> | |||
Lottie = 3, | |||
} | |||
} |
@@ -1,40 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a user mention object. | |||
/// </summary> | |||
public record UserMention : User | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="UserMention"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">The user's id.</param> | |||
/// <param name="username">The user's username, not unique across the platform.</param> | |||
/// <param name="discriminator">The user's 4-digit discord-tag.</param> | |||
/// <param name="avatar">The user's avatar hash.</param> | |||
/// <param name="bot">Whether the user belongs to an OAuth2 application.</param> | |||
/// <param name="system">Whether the user is an Official Discord System user (part of the urgent message system).</param> | |||
/// <param name="mfaEnabled">Whether the user has two factor enabled on their account.</param> | |||
/// <param name="locale">The user's chosen language option.</param> | |||
/// <param name="verified">Whether the email on this account has been verified.</param> | |||
/// <param name="email">The user's email.</param> | |||
/// <param name="flags">The flags on a user's account.</param> | |||
/// <param name="premiumType">The type of Nitro subscription on a user's account.</param> | |||
/// <param name="publicFlags">The public flags on a user's account.</param> | |||
/// <param name="member">Additional partial member field.</param> | |||
[JsonConstructor] | |||
public UserMention(Snowflake id, string username, string discriminator, string? avatar, Optional<bool> bot, Optional<bool> system, Optional<bool> mfaEnabled, Optional<string> locale, Optional<bool> verified, Optional<string?> email, Optional<UserFlags> flags, Optional<PremiumType> premiumType, Optional<UserFlags> publicFlags, Optional<GuildMember> member) | |||
: base(id, username, discriminator, avatar, bot, system, mfaEnabled, locale, verified, email, flags, premiumType, publicFlags) | |||
{ | |||
Member = member; | |||
} | |||
/// <summary> | |||
/// Additional partial member field. | |||
/// </summary> | |||
[JsonPropertyName("member")] | |||
public Optional<GuildMember> Member { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a overwrite object. | |||
/// </summary> | |||
public record Overwrite | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Overwrite"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Role or user id.</param> | |||
/// <param name="type">Type of entity this overwrite belongs to.</param> | |||
/// <param name="allow">Permission bit set.</param> | |||
/// <param name="deny">Permission bit set.</param> | |||
[JsonConstructor] | |||
public Overwrite(Snowflake id, OverwriteType type, string allow, string deny) | |||
{ | |||
Id = id; | |||
Type = type; | |||
Allow = allow; | |||
Deny = deny; | |||
} | |||
/// <summary> | |||
/// Role or user id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Type of entity this overwrite belongs to. | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public OverwriteType Type { get; } | |||
/// <summary> | |||
/// Permission bit set. | |||
/// </summary> | |||
[JsonPropertyName("allow")] | |||
public string Allow { get; } | |||
/// <summary> | |||
/// Permission bit set. | |||
/// </summary> | |||
[JsonPropertyName("deny")] | |||
public string Deny { get; } | |||
} | |||
} |
@@ -1,17 +0,0 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the type of the overwrite. | |||
/// </summary> | |||
public enum OverwriteType | |||
{ | |||
/// <summary> | |||
/// The type of the overwrite is a role. | |||
/// </summary> | |||
Role = 0, | |||
/// <summary> | |||
/// The type of the overwrite is a member. | |||
/// </summary> | |||
Member = 1, | |||
} | |||
} |
@@ -1,51 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a thread member object. | |||
/// </summary> | |||
public record ThreadMember | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="ThreadMember"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">The id of the thread.</param> | |||
/// <param name="userId">The id of the user.</param> | |||
/// <param name="joinTimestamp">The time the current user last joined the thread.</param> | |||
/// <param name="flags">Any user-thread settings, currently only used for notifications.</param> | |||
[JsonConstructor] | |||
public ThreadMember(Snowflake id, Snowflake userId, DateTimeOffset joinTimestamp, int flags) | |||
{ | |||
Id = id; | |||
UserId = userId; | |||
JoinTimestamp = joinTimestamp; | |||
Flags = flags; | |||
} | |||
/// <summary> | |||
/// The id of the thread. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// The id of the user. | |||
/// </summary> | |||
[JsonPropertyName("user_id")] | |||
public Snowflake UserId { get; } | |||
/// <summary> | |||
/// The time the current user last joined the thread. | |||
/// </summary> | |||
[JsonPropertyName("join_timestamp")] | |||
public DateTimeOffset JoinTimestamp { get; } | |||
/// <summary> | |||
/// Any user-thread settings, currently only used for notifications. | |||
/// </summary> | |||
[JsonPropertyName("flags")] | |||
public int Flags { get; } | |||
} | |||
} |
@@ -1,59 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a thread metadata object. | |||
/// </summary> | |||
public record ThreadMetadata | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="ThreadMetadata"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="archived">Whether the thread is archived.</param> | |||
/// <param name="archiverId">Id of the user that last archived or unarchived the thread.</param> | |||
/// <param name="autoArchiveDuration">Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080.</param> | |||
/// <param name="archiveTimestamp">Timestamp when the thread's archive status was last changed, used for calculating recent activity.</param> | |||
/// <param name="locked">When a thread is locked, only users with MANAGE_THREADS can unarchive it.</param> | |||
[JsonConstructor] | |||
public ThreadMetadata(bool archived, Optional<Snowflake> archiverId, int autoArchiveDuration, DateTimeOffset archiveTimestamp, Optional<bool> locked) | |||
{ | |||
Archived = archived; | |||
ArchiverId = archiverId; | |||
AutoArchiveDuration = autoArchiveDuration; | |||
ArchiveTimestamp = archiveTimestamp; | |||
Locked = locked; | |||
} | |||
/// <summary> | |||
/// Whether the thread is archived. | |||
/// </summary> | |||
[JsonPropertyName("archived")] | |||
public bool Archived { get; } | |||
/// <summary> | |||
/// Id of the user that last archived or unarchived the thread. | |||
/// </summary> | |||
[JsonPropertyName("archiver_id")] | |||
public Optional<Snowflake> ArchiverId { get; } | |||
/// <summary> | |||
/// Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080. | |||
/// </summary> | |||
[JsonPropertyName("auto_archive_duration")] | |||
public int AutoArchiveDuration { get; } | |||
/// <summary> | |||
/// Timestamp when the thread's archive status was last changed, used for calculating recent activity. | |||
/// </summary> | |||
[JsonPropertyName("archive_timestamp")] | |||
public DateTimeOffset ArchiveTimestamp { get; } | |||
/// <summary> | |||
/// When a thread is locked, only users with MANAGE_THREADS can unarchive it. | |||
/// </summary> | |||
[JsonPropertyName("locked")] | |||
public Optional<bool> Locked { get; } | |||
} | |||
} |
@@ -1,21 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the video quality mode type. | |||
/// </summary> | |||
[Flags] | |||
public enum VideoQualityMode | |||
{ | |||
/// <summary> | |||
/// Discord chooses the quality for optimal performance. | |||
/// </summary> | |||
Auto = 1, | |||
/// <summary> | |||
/// 720p. | |||
/// </summary> | |||
Full = 2, | |||
} | |||
} |
@@ -0,0 +1,174 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord channel object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/channel#channel-object-channel-structure"/> | |||
/// </remarks> | |||
public record Channel | |||
{ | |||
/// <summary> | |||
/// The id of this <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; init; } | |||
/// <summary> | |||
/// The type of <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public ChannelType Type { get; init; } | |||
/// <summary> | |||
/// The id of the <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// May be missing for some channel objects received over gateway guild dispatches. | |||
/// </remarks> | |||
[JsonPropertyName("guild_id")] | |||
public Optional<Snowflake> GuildId { get; init; } | |||
/// <summary> | |||
/// Sorting position of the <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("position")] | |||
public Optional<int> Position { get; init; } | |||
/// <summary> | |||
/// Explicit permission <see cref="Overwrite"/>s for <see cref="GuildMember"/>s | |||
/// and <see cref="Role"/>s. | |||
/// </summary> | |||
[JsonPropertyName("permission_overwrites")] | |||
public Optional<Overwrite[]> PermissionOverwrites { get; init; } | |||
/// <summary> | |||
/// The name of the <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public Optional<string> Name { get; init; } | |||
/// <summary> | |||
/// The <see cref="Channel"/> topic. | |||
/// </summary> | |||
[JsonPropertyName("topic")] | |||
public Optional<string?> Topic { get; init; } | |||
/// <summary> | |||
/// Whether the <see cref="Channel"/> is nsfw. | |||
/// </summary> | |||
[JsonPropertyName("nsfw")] | |||
public Optional<bool> Nsfw { get; init; } | |||
/// <summary> | |||
/// The id of the last <see cref="Message"/> sent in this <see cref="Channel"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// May not point to an existing or valid message. | |||
/// </remarks> | |||
[JsonPropertyName("last_message_id")] | |||
public Optional<Snowflake?> LastMessageId { get; init; } | |||
/// <summary> | |||
/// The bitrate (in bits) of the voice <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("bitrate")] | |||
public Optional<int> Bitrate { get; init; } | |||
/// <summary> | |||
/// The <see cref="User"/> limit of the voice <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("user_limit")] | |||
public Optional<int> UserLimit { get; init; } | |||
/// <summary> | |||
/// Amount of seconds a <see cref="User"/> has to wait before sending another <see cref="Message"/>; | |||
/// bots, as well as <see cref="User"/>s with the permission <see cref="Permissions.ManageMessages"/> | |||
/// or <see cref="Permissions.ManageChannels"/>, are unaffected. | |||
/// </summary> | |||
[JsonPropertyName("rate_limit_per_user")] | |||
public Optional<int> RateLimitPerUser { get; init; } | |||
/// <summary> | |||
/// The recipients of the DM. | |||
/// </summary> | |||
[JsonPropertyName("recipients")] | |||
public Optional<User[]> Recipients { get; init; } | |||
/// <summary> | |||
/// Icon hash. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public Optional<string?> Icon { get; init; } | |||
/// <summary> | |||
/// Id of the creator of the group DM or thread. | |||
/// </summary> | |||
[JsonPropertyName("owner_id")] | |||
public Optional<Snowflake> OwnerId { get; init; } | |||
/// <summary> | |||
/// <see cref="Application"/> id of the group DM creator if it is bot-created. | |||
/// </summary> | |||
[JsonPropertyName("application_id")] | |||
public Optional<Snowflake> ApplicationId { get; init; } | |||
/// <summary> | |||
/// For guild channels: id of the parent category for a channel (each parent | |||
/// category can contain up to 50 channels), for threads: id of the text channel | |||
/// this thread was created. | |||
/// </summary> | |||
[JsonPropertyName("parent_id")] | |||
public Optional<Snowflake?> ParentId { get; init; } | |||
/// <summary> | |||
/// When the last pinned <see cref="Message"/> was pinned. | |||
/// </summary> | |||
/// <remarks> | |||
/// This may be null in events such | |||
/// as GUILD_CREATE when a message is not pinned. | |||
/// </remarks> | |||
[JsonPropertyName("last_pin_timestamp")] | |||
public Optional<DateTimeOffset?> LastPinTimestamp { get; init; } | |||
/// <summary> | |||
/// Voice region id for the voice <see cref="Channel"/>, automatic when set to null. | |||
/// </summary> | |||
[JsonPropertyName("rtc_region")] | |||
public Optional<string?> RtcRegion { get; init; } | |||
/// <summary> | |||
/// The camera video quality mode of the voice channel, 1 when not present. | |||
/// </summary> | |||
[JsonPropertyName("video_quality_mode")] | |||
public Optional<VideoQualityMode> VideoQualityMode { get; init; } | |||
/// <summary> | |||
/// An approximate count of <see cref="Message"/>s in a thread, stops counting at 50. | |||
/// </summary> | |||
[JsonPropertyName("message_count")] | |||
public Optional<int> MessageCount { get; init; } | |||
/// <summary> | |||
/// An approximate count of <see cref="User"/>s in a thread, stops counting at 50. | |||
/// </summary> | |||
[JsonPropertyName("member_count")] | |||
public Optional<int> MemberCount { get; init; } | |||
/// <summary> | |||
/// Thread-specific fields not needed by other channels. | |||
/// </summary> | |||
[JsonPropertyName("thread_metadata")] | |||
public Optional<ThreadMetadata> ThreadMetadata { get; init; } | |||
/// <summary> | |||
/// Thread member object for the current user, if they have joined the | |||
/// thread, only included on certain API endpoints. | |||
/// </summary> | |||
[JsonPropertyName("member")] | |||
public Optional<ThreadMember> Member { get; init; } | |||
} | |||
} |
@@ -0,0 +1,67 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the channel type for a <see cref="Channel"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/channel#channel-object-channel-types"/> | |||
/// </remarks> | |||
public enum ChannelType | |||
{ | |||
/// <summary> | |||
/// A text channel within a <see cref="Guild"/>. | |||
/// </summary> | |||
GuildText = 0, | |||
/// <summary> | |||
/// A direct message between <see cref="User"/>s. | |||
/// </summary> | |||
Dm = 1, | |||
/// <summary> | |||
/// A voice channel within a server. | |||
/// </summary> | |||
GuildVoice = 2, | |||
/// <summary> | |||
/// A direct message between multiple users. | |||
/// </summary> | |||
GroupDm = 3, | |||
/// <summary> | |||
/// An organizational category that contains up to 50 channels. | |||
/// </summary> | |||
GuildCategory = 4, | |||
/// <summary> | |||
/// A channel that users can follow and crosspost into their own server. | |||
/// </summary> | |||
GuildNews = 5, | |||
/// <summary> | |||
/// A channel in which game developers can sell their game on Discord. | |||
/// </summary> | |||
GuildStore = 6, | |||
/// <summary> | |||
/// A temporary sub-channel within a GUILD_NEWS channel. | |||
/// </summary> | |||
GuildNewsThread = 10, | |||
/// <summary> | |||
/// A temporary sub-channel within a GUILD_TEXT channel. | |||
/// </summary> | |||
GuildPublicThread = 11, | |||
/// <summary> | |||
/// A temporary sub-channel within a GUILD_TEXT channel that is only viewable | |||
/// by those invited and those with the <see cref="Permissions.ManageThreads"/> permission. | |||
/// </summary> | |||
GuildPrivateThread = 12, | |||
/// <summary> | |||
/// A voice channel for hosting events with an audience. | |||
/// </summary> | |||
GuildStageVoice = 13, | |||
} | |||
} |
@@ -0,0 +1,64 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord emoji object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure"/> | |||
/// </remarks> | |||
public record Emoji | |||
{ | |||
/// <summary> | |||
/// Emoji id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake? Id { get; init; } | |||
/// <summary> | |||
/// Emoji name. | |||
/// </summary> | |||
/// <remarks> | |||
/// Can be null only in reaction emoji objects. | |||
/// </remarks> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; init; } | |||
/// <summary> | |||
/// <see cref="Role"/>s allowed to use this emoji. | |||
/// </summary> | |||
[JsonPropertyName("roles")] | |||
public Optional<Snowflake[]> Roles { get; init; } | |||
/// <summary> | |||
/// <see cref="User"/> that created this emoji. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public Optional<User> User { get; init; } | |||
/// <summary> | |||
/// Whether this emoji must be wrapped in colons. | |||
/// </summary> | |||
[JsonPropertyName("require_colons")] | |||
public Optional<bool> RequireColons { get; init; } | |||
/// <summary> | |||
/// Whether this emoji is managed. | |||
/// </summary> | |||
[JsonPropertyName("managed")] | |||
public Optional<bool> Managed { get; init; } | |||
/// <summary> | |||
/// Whether this emoji is animated. | |||
/// </summary> | |||
[JsonPropertyName("animated")] | |||
public Optional<bool> Animated { get; init; } | |||
/// <summary> | |||
/// Whether this emoji can be used, may be false due to loss of Server Boosts. | |||
/// </summary> | |||
[JsonPropertyName("available")] | |||
public Optional<bool> Available { get; init; } | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord followed channel object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/channel#followed-channel-object-followed-channel-structure"/> | |||
/// </remarks> | |||
public record FollowedChannel | |||
{ | |||
/// <summary> | |||
/// Source <see cref="Channel"/> id. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake ChannelId { get; init; } | |||
/// <summary> | |||
/// Created target <see cref="Webhook"/> id. | |||
/// </summary> | |||
[JsonPropertyName("webhook_id")] | |||
public Snowflake WebhookId { get; init; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the privacy level for a <see cref="StageInstance"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level"/> | |||
/// </remarks> | |||
public enum PrivacyLevel | |||
{ | |||
/// <summary> | |||
/// The <see cref="StageInstance"/> is visible publicly, such as on Stage discovery. | |||
/// </summary> | |||
Public = 1, | |||
/// <summary> | |||
/// The <see cref="StageInstance"/> is visible to only <see cref="GuildMember"/>s. | |||
/// </summary> | |||
GuildOnly = 2, | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord stage instance object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure"/> | |||
/// </remarks> | |||
public record StageInstance | |||
{ | |||
/// <summary> | |||
/// The id of this <see cref="StageInstance"/>. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// The <see cref="Guild"/> id of the associated Stage <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("guild_id")] | |||
public Snowflake GuildId { get; } | |||
/// <summary> | |||
/// The id of the associated Stage <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake ChannelId { get; } | |||
/// <summary> | |||
/// The topic of the <see cref="StageInstance"/>. | |||
/// </summary> | |||
[JsonPropertyName("topic")] | |||
public string? Topic { get; } // Required property candidate | |||
/// <summary> | |||
/// The <see cref="Models.PrivacyLevel"/> of the <see cref="StageInstance"/>. | |||
/// </summary> | |||
[JsonPropertyName("privacy_level")] | |||
public PrivacyLevel PrivacyLevel { get; } | |||
/// <summary> | |||
/// Whether or not Stage discovery is disabled. | |||
/// </summary> | |||
[JsonPropertyName("discoverable_disabled")] | |||
public bool DiscoverableDisabled { get; } | |||
} | |||
} |
@@ -0,0 +1,38 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord thread member object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/channel#thread-member-object-thread-member-structure"/> | |||
/// </remarks> | |||
public record ThreadMember | |||
{ | |||
/// <summary> | |||
/// The id of the thread. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; init; } | |||
/// <summary> | |||
/// The id of the <see cref="User"/>. | |||
/// </summary> | |||
[JsonPropertyName("user_id")] | |||
public Snowflake UserId { get; init; } | |||
/// <summary> | |||
/// The time the current <see cref="User"/> last joined the thread. | |||
/// </summary> | |||
[JsonPropertyName("join_timestamp")] | |||
public DateTimeOffset JoinTimestamp { get; init; } | |||
/// <summary> | |||
/// Any user-thread settings, currently only used for notifications. | |||
/// </summary> | |||
[JsonPropertyName("flags")] | |||
public int Flags { get; init; } | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord thread metadata object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure"/> | |||
/// </remarks> | |||
public record ThreadMetadata | |||
{ | |||
/// <summary> | |||
/// Whether the thread is archived. | |||
/// </summary> | |||
[JsonPropertyName("archived")] | |||
public bool Archived { get; init; } | |||
/// <summary> | |||
/// Id of the <see cref="User"/> that last archived or unarchived the thread. | |||
/// </summary> | |||
[JsonPropertyName("archiver_id")] | |||
public Optional<Snowflake> ArchiverId { get; init; } | |||
/// <summary> | |||
/// Duration in minutes to automatically archive the thread after | |||
/// recent activity, can be set to: 60, 1440, 4320, 10080. | |||
/// </summary> | |||
[JsonPropertyName("auto_archive_duration")] | |||
public int AutoArchiveDuration { get; init; } | |||
/// <summary> | |||
/// Timestamp when the thread's archive status was last changed, used for | |||
/// calculating recent activity. | |||
/// </summary> | |||
[JsonPropertyName("archive_timestamp")] | |||
public DateTimeOffset ArchiveTimestamp { get; init; } | |||
/// <summary> | |||
/// When a thread is locked, only <see cref="User"/>s with | |||
/// <see cref="Permissions.ManageThreads"/> can unarchive it. | |||
/// </summary> | |||
[JsonPropertyName("locked")] | |||
public Optional<bool> Locked { get; init; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the video quality mode. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes"/> | |||
/// </remarks> | |||
public enum VideoQualityMode | |||
{ | |||
/// <summary> | |||
/// Discord chooses the quality for optimal performance. | |||
/// </summary> | |||
Auto = 1, | |||
/// <summary> | |||
/// 720p. | |||
/// </summary> | |||
Full = 2, | |||
} | |||
} |
@@ -0,0 +1,37 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a welcome screen channel object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure"/> | |||
/// </remarks> | |||
public record WelcomeScreenChannel | |||
{ | |||
/// <summary> | |||
/// The <see cref="WelcomeScreenChannel"/>'s id. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake ChannelId { get; init; } | |||
/// <summary> | |||
/// The description shown for the <see cref="WelcomeScreenChannel"/>. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The <see cref="Emoji.Id"/>, if the <see cref="Emoji"/> is custom. | |||
/// </summary> | |||
[JsonPropertyName("emoji_id")] | |||
public Snowflake? EmojiId { get; init; } | |||
/// <summary> | |||
/// The <see cref="Emoji.Name"/> if custom, the unicode character if standard, or null if no <see cref="Emoji"/> is set. | |||
/// </summary> | |||
[JsonPropertyName("emoji_name")] | |||
public string? EmojiName { get; init; } | |||
} | |||
} |
@@ -0,0 +1,246 @@ | |||
using System; | |||
using System.Diagnostics; | |||
using StandardColor = System.Drawing.Color; | |||
namespace Discord.Net | |||
{ | |||
/// <summary> | |||
/// Represents a RGB (red, green, blue) color. | |||
/// </summary> | |||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | |||
public struct Color | |||
{ | |||
#region Colors | |||
/// <summary> | |||
/// Gets the default user color value. | |||
/// </summary> | |||
public static readonly Color Default = new(0); | |||
/// <summary> | |||
/// Gets the teal color value. | |||
/// </summary> | |||
public static readonly Color Teal = new(0x1ABC9C); | |||
/// <summary> | |||
/// Gets the dark teal color value. | |||
/// </summary> | |||
public static readonly Color DarkTeal = new(0x11806A); | |||
/// <summary> | |||
/// Gets the green color value. | |||
/// </summary> | |||
public static readonly Color Green = new(0x2ECC71); | |||
/// <summary> | |||
/// Gets the dark green color value. | |||
/// </summary> | |||
public static readonly Color DarkGreen = new(0x1F8B4C); | |||
/// <summary> | |||
/// Gets the blue color value. | |||
/// </summary> | |||
public static readonly Color Blue = new(0x3498DB); | |||
/// <summary> | |||
/// Gets the dark blue color value. | |||
/// </summary> | |||
public static readonly Color DarkBlue = new(0x206694); | |||
/// <summary> | |||
/// Gets the purple color value. | |||
/// </summary> | |||
public static readonly Color Purple = new(0x9B59B6); | |||
/// <summary> | |||
/// Gets the dark purple color value. | |||
/// </summary> | |||
public static readonly Color DarkPurple = new(0x71368A); | |||
/// <summary> | |||
/// Gets the magenta color value. | |||
/// </summary> | |||
public static readonly Color Magenta = new(0xE91E63); | |||
/// <summary> | |||
/// Gets the dark magenta color value. | |||
/// </summary> | |||
public static readonly Color DarkMagenta = new(0xAD1457); | |||
/// <summary> | |||
/// Gets the gold color value. | |||
/// </summary> | |||
public static readonly Color Gold = new(0xF1C40F); | |||
/// <summary> | |||
/// Gets the light orange color value. | |||
/// </summary> | |||
public static readonly Color LightOrange = new(0xC27C0E); | |||
/// <summary> | |||
/// Gets the orange color value. | |||
/// </summary> | |||
public static readonly Color Orange = new(0xE67E22); | |||
/// <summary> | |||
/// Gets the dark orange color value. | |||
/// </summary> | |||
public static readonly Color DarkOrange = new(0xA84300); | |||
/// <summary> | |||
/// Gets the red color value. | |||
/// </summary> | |||
public static readonly Color Red = new(0xE74C3C); | |||
/// <summary> | |||
/// Gets the dark red color value. | |||
/// </summary> | |||
public static readonly Color DarkRed = new(0x992D22); | |||
/// <summary> | |||
/// Gets the light grey color value. | |||
/// </summary> | |||
public static readonly Color LightGrey = new(0x979C9F); | |||
/// <summary> | |||
/// Gets the lighter grey color value. | |||
/// </summary> | |||
public static readonly Color LighterGrey = new(0x95A5A6); | |||
/// <summary> | |||
/// Gets the dark grey color value. | |||
/// </summary> | |||
public static readonly Color DarkGrey = new(0x607D8B); | |||
/// <summary> | |||
/// Gets the darker grey color value. | |||
/// </summary> | |||
public static readonly Color DarkerGrey = new(0x546E7A); | |||
#endregion Colors | |||
/// <summary> | |||
/// Gets the encoded value for this color. | |||
/// </summary> | |||
public uint RawValue { get; } | |||
/// <summary> | |||
/// Gets the red component for this color. | |||
/// </summary> | |||
public byte R => (byte)(RawValue >> 16); | |||
/// <summary> | |||
/// Gets the green component for this color. | |||
/// </summary> | |||
public byte G => (byte)(RawValue >> 8); | |||
/// <summary> | |||
/// Gets the blue component for this color. | |||
/// </summary> | |||
public byte B => (byte)(RawValue); | |||
/// <summary> | |||
/// Creates a <see cref="Color"/> based on an encoded value. | |||
/// </summary> | |||
/// <param name="rawValue"> | |||
/// Color encoded value. | |||
/// </param> | |||
public Color(uint rawValue) | |||
{ | |||
RawValue = rawValue; | |||
} | |||
/// <summary> | |||
/// Creates a <see cref="Color"/> based on the RGB color provided by <see cref="byte"/>s. | |||
/// </summary> | |||
/// <param name="red"> | |||
/// Red color. | |||
/// </param> | |||
/// <param name="green"> | |||
/// Green color. | |||
/// </param> | |||
/// <param name="blue"> | |||
/// Blue color. | |||
/// </param> | |||
public Color(byte red, byte green, byte blue) | |||
{ | |||
RawValue = ((uint)red << 16) | ((uint)green << 8) | blue; | |||
} | |||
/// <summary> | |||
/// Creates a <see cref="Color"/> based on the RGB color provided by <see cref="int"/>s. | |||
/// </summary> | |||
/// <param name="red"> | |||
/// Red color. | |||
/// </param> | |||
/// <param name="green"> | |||
/// Green color. | |||
/// </param> | |||
/// <param name="blue"> | |||
/// Blue color. | |||
/// </param> | |||
public Color(int red, int green, int blue) | |||
{ | |||
if (red < 0 || red > 255) | |||
throw new ArgumentOutOfRangeException(nameof(red), "Value must be within [0,255]"); | |||
if (green < 0 || green > 255) | |||
throw new ArgumentOutOfRangeException(nameof(green), "Value must be within [0,255]"); | |||
if (blue < 0 || blue > 255) | |||
throw new ArgumentOutOfRangeException(nameof(blue), "Value must be within [0,255]"); | |||
RawValue = ((uint)red << 16) | ((uint)green << 8) | (uint)blue; | |||
} | |||
/// <summary> | |||
/// Creates a <see cref="Color"/> based on the RGB color provided by <see cref="float"/>s. | |||
/// </summary> | |||
/// <param name="red"> | |||
/// Red color. | |||
/// </param> | |||
/// <param name="green"> | |||
/// Green color. | |||
/// </param> | |||
/// <param name="blue"> | |||
/// Blue color. | |||
/// </param> | |||
public Color(float red, float green, float blue) | |||
{ | |||
if (red < 0.0f || red > 1.0f) | |||
throw new ArgumentOutOfRangeException(nameof(red), "Value must be within [0,1]"); | |||
if (green < 0.0f || green > 1.0f) | |||
throw new ArgumentOutOfRangeException(nameof(green), "Value must be within [0,1]"); | |||
if (blue < 0.0f || blue > 1.0f) | |||
throw new ArgumentOutOfRangeException(nameof(blue), "Value must be within [0,1]"); | |||
RawValue = | |||
((uint)(red * 255.0f) << 16) | | |||
((uint)(green * 255.0f) << 8) | | |||
(uint)(blue * 255.0f); | |||
} | |||
/// <summary> | |||
/// Implicitly converts this <see cref="Color"/> to <see cref="StandardColor"/>. | |||
/// </summary> | |||
/// <param name="color"> | |||
/// <see cref="Color"/> to convert. | |||
/// </param> | |||
public static implicit operator StandardColor(Color color) | |||
=> StandardColor.FromArgb((int)color.RawValue); | |||
/// <summary> | |||
/// Explicitly converts a <see cref="StandardColor"/> to a <see cref="Color"/>. | |||
/// </summary> | |||
/// <param name="color"> | |||
/// <see cref="StandardColor"/> to convert. | |||
/// </param> | |||
public static explicit operator Color(StandardColor color) | |||
=> new((uint)color.ToArgb() << 8 >> 8); | |||
/// <summary> | |||
/// Returns the encoded raw value as <see cref="string"/>. | |||
/// </summary> | |||
/// <returns></returns> | |||
public override string ToString() | |||
=> $"#{Convert.ToString(RawValue, 16)}"; | |||
private string DebuggerDisplay | |||
=> $"#{Convert.ToString(RawValue, 16)} ({RawValue})"; | |||
} | |||
} |
@@ -1,85 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a emoji object. | |||
/// </summary> | |||
public record Emoji | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Emoji"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Emoji id.</param> | |||
/// <param name="name">Emoji name.</param> | |||
/// <param name="roles">Roles allowed to use this emoji.</param> | |||
/// <param name="user">User that created this emoji.</param> | |||
/// <param name="requireColons">Whether this emoji must be wrapped in colons.</param> | |||
/// <param name="managed">Whether this emoji is managed.</param> | |||
/// <param name="animated">Whether this emoji is animated.</param> | |||
/// <param name="available">Whether this emoji can be used, may be false due to loss of Server Boosts.</param> | |||
[JsonConstructor] | |||
public Emoji(Snowflake? id, string? name, Optional<Snowflake[]> roles, Optional<User> user, Optional<bool> requireColons, Optional<bool> managed, Optional<bool> animated, Optional<bool> available) | |||
{ | |||
Id = id; | |||
Name = name; | |||
Roles = roles; | |||
User = user; | |||
RequireColons = requireColons; | |||
Managed = managed; | |||
Animated = animated; | |||
Available = available; | |||
} | |||
/// <summary> | |||
/// Emoji id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake? Id { get; } | |||
/// <summary> | |||
/// Emoji name. | |||
/// </summary> | |||
/// <remarks> | |||
/// Can be null only in reaction emoji objects. | |||
/// </remarks> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; } | |||
/// <summary> | |||
/// Roles allowed to use this emoji. | |||
/// </summary> | |||
[JsonPropertyName("roles")] | |||
public Optional<Snowflake[]> Roles { get; } | |||
/// <summary> | |||
/// User that created this emoji. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public Optional<User> User { get; } | |||
/// <summary> | |||
/// Whether this emoji must be wrapped in colons. | |||
/// </summary> | |||
[JsonPropertyName("require_colons")] | |||
public Optional<bool> RequireColons { get; } | |||
/// <summary> | |||
/// Whether this emoji is managed. | |||
/// </summary> | |||
[JsonPropertyName("managed")] | |||
public Optional<bool> Managed { get; } | |||
/// <summary> | |||
/// Whether this emoji is animated. | |||
/// </summary> | |||
[JsonPropertyName("animated")] | |||
public Optional<bool> Animated { get; } | |||
/// <summary> | |||
/// Whether this emoji can be used, may be false due to loss of Server Boosts. | |||
/// </summary> | |||
[JsonPropertyName("available")] | |||
public Optional<bool> Available { get; } | |||
} | |||
} |
@@ -1,138 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,42 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,42 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,35 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,42 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,58 +0,0 @@ | |||
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; } | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a ban object. | |||
/// </summary> | |||
public record Ban | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Ban"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="reason">The reason for the ban.</param> | |||
/// <param name="user">The banned user.</param> | |||
[JsonConstructor] | |||
public Ban(string? reason, User user) | |||
{ | |||
Reason = reason; | |||
User = user; | |||
} | |||
/// <summary> | |||
/// The reason for the ban. | |||
/// </summary> | |||
[JsonPropertyName("reason")] | |||
public string? Reason { get; } | |||
/// <summary> | |||
/// The banned user. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public User User { get; } | |||
} | |||
} |
@@ -1,20 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the default message notification level. | |||
/// </summary> | |||
public enum DefaultMessageNotificationLevel | |||
{ | |||
/// <summary> | |||
/// Members will receive notifications for all messages by default. | |||
/// </summary> | |||
AllMessages = 0, | |||
/// <summary> | |||
/// Members will receive notifications only for messages that @mention them by default. | |||
/// </summary> | |||
OnlyMentions = 1, | |||
} | |||
} |
@@ -1,25 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the explicit content filter level. | |||
/// </summary> | |||
public enum ExplicitContentFilterLevel | |||
{ | |||
/// <summary> | |||
/// Media content will not be scanned. | |||
/// </summary> | |||
Disabled = 0, | |||
/// <summary> | |||
/// Media content sent by members without roles will be scanned. | |||
/// </summary> | |||
MembersWithoutRoles = 1, | |||
/// <summary> | |||
/// Media content sent by all members will be scanned. | |||
/// </summary> | |||
AllMembers = 2, | |||
} | |||
} |
@@ -1,411 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a guild object. | |||
/// </summary> | |||
public record Guild | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Guild"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Guild id.</param> | |||
/// <param name="name">Guild name (2-100 characters, excluding trailing and leading whitespace).</param> | |||
/// <param name="icon">Icon hash.</param> | |||
/// <param name="iconHash">Icon hash, returned when in the template object.</param> | |||
/// <param name="splash">Splash hash.</param> | |||
/// <param name="discoverySplash">Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature.</param> | |||
/// <param name="owner">True if the user is the owner of the guild.</param> | |||
/// <param name="ownerId">Id of owner.</param> | |||
/// <param name="permissions">Total permissions for the user in the guild (excludes overwrites).</param> | |||
/// <param name="region">Voice region id for the guild.</param> | |||
/// <param name="afkChannelId">Id of afk channel.</param> | |||
/// <param name="afkTimeout">Afk timeout in seconds.</param> | |||
/// <param name="widgetEnabled">True if the server widget is enabled.</param> | |||
/// <param name="widgetChannelId">The channel id that the widget will generate an invite to, or null if set to no invite.</param> | |||
/// <param name="verificationLevel">Verification level required for the guild.</param> | |||
/// <param name="defaultMessageNotifications">Default message notifications level.</param> | |||
/// <param name="explicitContentFilter">Explicit content filter level.</param> | |||
/// <param name="roles">Roles in the guild.</param> | |||
/// <param name="emojis">Custom guild emojis.</param> | |||
/// <param name="features">Enabled guild features.</param> | |||
/// <param name="mfaLevel">Required MFA level for the guild.</param> | |||
/// <param name="applicationId">Application id of the guild creator if it is bot-created.</param> | |||
/// <param name="systemChannelId">The id of the channel where guild notices such as welcome messages and boost events are posted.</param> | |||
/// <param name="systemChannelFlags">System channel flags.</param> | |||
/// <param name="rulesChannelId">The id of the channel where Community guilds can display rules and/or guidelines.</param> | |||
/// <param name="joinedAt">When this guild was joined at.</param> | |||
/// <param name="large">True if this is considered a large guild.</param> | |||
/// <param name="unavailable">True if this guild is unavailable due to an outage.</param> | |||
/// <param name="memberCount">Total number of members in this guild.</param> | |||
/// <param name="voiceStates">States of members currently in voice channels; lacks the guild_id key.</param> | |||
/// <param name="members">Users in the guild.</param> | |||
/// <param name="channels">Channels in the guild.</param> | |||
/// <param name="threads">All active threads in the guild that current user has permission to view.</param> | |||
/// <param name="presences">Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold.</param> | |||
/// <param name="maxPresences">The maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned).</param> | |||
/// <param name="maxMembers">The maximum number of members for the guild.</param> | |||
/// <param name="vanityUrlCode">The vanity url code for the guild.</param> | |||
/// <param name="description">The description of a Community guild.</param> | |||
/// <param name="banner">Banner hash.</param> | |||
/// <param name="premiumTier">Premium tier (Server Boost level).</param> | |||
/// <param name="premiumSubscriptionCount">The number of boosts this guild currently has.</param> | |||
/// <param name="preferredLocale">The preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US".</param> | |||
/// <param name="publicUpdatesChannelId">The id of the channel where admins and moderators of Community guilds receive notices from Discord.</param> | |||
/// <param name="maxVideoChannelUsers">The maximum amount of users in a video channel.</param> | |||
/// <param name="approximateMemberCount">Approximate number of members in this guild.</param> | |||
/// <param name="approximatePresenceCount">Approximate number of non-offline members in this guild.</param> | |||
/// <param name="welcomeScreen">The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object.</param> | |||
/// <param name="nsfwLevel">Guild NSFW level.</param> | |||
/// <param name="stageInstances">Stage instances in the guild.</param> | |||
[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<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; | |||
Name = name; | |||
Icon = icon; | |||
IconHash = iconHash; | |||
Splash = splash; | |||
DiscoverySplash = discoverySplash; | |||
Owner = owner; | |||
OwnerId = ownerId; | |||
Permissions = permissions; | |||
Region = region; | |||
AfkChannelId = afkChannelId; | |||
AfkTimeout = afkTimeout; | |||
WidgetEnabled = widgetEnabled; | |||
WidgetChannelId = widgetChannelId; | |||
VerificationLevel = verificationLevel; | |||
DefaultMessageNotifications = defaultMessageNotifications; | |||
ExplicitContentFilter = explicitContentFilter; | |||
Roles = roles; | |||
Emojis = emojis; | |||
Features = features; | |||
MfaLevel = mfaLevel; | |||
ApplicationId = applicationId; | |||
SystemChannelId = systemChannelId; | |||
SystemChannelFlags = systemChannelFlags; | |||
RulesChannelId = rulesChannelId; | |||
JoinedAt = joinedAt; | |||
Large = large; | |||
Unavailable = unavailable; | |||
MemberCount = memberCount; | |||
VoiceStates = voiceStates; | |||
Members = members; | |||
Channels = channels; | |||
Threads = threads; | |||
Presences = presences; | |||
MaxPresences = maxPresences; | |||
MaxMembers = maxMembers; | |||
VanityUrlCode = vanityUrlCode; | |||
Description = description; | |||
Banner = banner; | |||
PremiumTier = premiumTier; | |||
PremiumSubscriptionCount = premiumSubscriptionCount; | |||
PreferredLocale = preferredLocale; | |||
PublicUpdatesChannelId = publicUpdatesChannelId; | |||
MaxVideoChannelUsers = maxVideoChannelUsers; | |||
ApproximateMemberCount = approximateMemberCount; | |||
ApproximatePresenceCount = approximatePresenceCount; | |||
WelcomeScreen = welcomeScreen; | |||
NsfwLevel = nsfwLevel; | |||
StageInstances = stageInstances; | |||
} | |||
/// <summary> | |||
/// Guild id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Guild name. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// Icon hash. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public string? Icon { get; } | |||
/// <summary> | |||
/// Icon hash, returned when in the template object. | |||
/// </summary> | |||
[JsonPropertyName("icon_hash")] | |||
public Optional<string?> IconHash { get; } | |||
/// <summary> | |||
/// Splash hash. | |||
/// </summary> | |||
[JsonPropertyName("splash")] | |||
public string? Splash { get; } | |||
/// <summary> | |||
/// Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature. | |||
/// </summary> | |||
[JsonPropertyName("discovery_splash")] | |||
public string? DiscoverySplash { get; } | |||
/// <summary> | |||
/// True if the user is the owner of the guild. | |||
/// </summary> | |||
[JsonPropertyName("owner")] | |||
public Optional<bool> Owner { get; } | |||
/// <summary> | |||
/// Id of owner. | |||
/// </summary> | |||
[JsonPropertyName("owner_id")] | |||
public Snowflake OwnerId { get; } | |||
/// <summary> | |||
/// Total permissions for the user in the guild (excludes overwrites). | |||
/// </summary> | |||
[JsonPropertyName("permissions")] | |||
public Optional<Permissions> Permissions { get; } | |||
/// <summary> | |||
/// Voice region id for the guild. | |||
/// </summary> | |||
[JsonPropertyName("region")] | |||
public string Region { get; } | |||
/// <summary> | |||
/// Id of afk channel. | |||
/// </summary> | |||
[JsonPropertyName("afk_channel_id")] | |||
public Snowflake? AfkChannelId { get; } | |||
/// <summary> | |||
/// Afk timeout in seconds. | |||
/// </summary> | |||
[JsonPropertyName("afk_timeout")] | |||
public int AfkTimeout { get; } | |||
/// <summary> | |||
/// True if the server widget is enabled. | |||
/// </summary> | |||
[JsonPropertyName("widget_enabled")] | |||
public Optional<bool> WidgetEnabled { get; } | |||
/// <summary> | |||
/// The channel id that the widget will generate an invite to, or null if set to no invite. | |||
/// </summary> | |||
[JsonPropertyName("widget_channel_id")] | |||
public Optional<Snowflake?> WidgetChannelId { get; } | |||
/// <summary> | |||
/// Verification level required for the guild. | |||
/// </summary> | |||
[JsonPropertyName("verification_level")] | |||
public int VerificationLevel { get; } | |||
/// <summary> | |||
/// Default message notifications level. | |||
/// </summary> | |||
[JsonPropertyName("default_message_notifications")] | |||
public int DefaultMessageNotifications { get; } | |||
/// <summary> | |||
/// Explicit content filter level. | |||
/// </summary> | |||
[JsonPropertyName("explicit_content_filter")] | |||
public int ExplicitContentFilter { get; } | |||
/// <summary> | |||
/// Roles in the guild. | |||
/// </summary> | |||
[JsonPropertyName("roles")] | |||
public Role[] Roles { get; } | |||
/// <summary> | |||
/// Custom guild emojis. | |||
/// </summary> | |||
[JsonPropertyName("emojis")] | |||
public Emoji[] Emojis { get; } | |||
/// <summary> | |||
/// Enabled guild features. | |||
/// </summary> | |||
[JsonPropertyName("features")] | |||
public string[] Features { get; } | |||
/// <summary> | |||
/// Required MFA level for the guild. | |||
/// </summary> | |||
[JsonPropertyName("mfa_level")] | |||
public int MfaLevel { get; } | |||
/// <summary> | |||
/// Application id of the guild creator if it is bot-created. | |||
/// </summary> | |||
[JsonPropertyName("application_id")] | |||
public Snowflake? ApplicationId { get; } | |||
/// <summary> | |||
/// The id of the channel where guild notices such as welcome messages and boost events are posted. | |||
/// </summary> | |||
[JsonPropertyName("system_channel_id")] | |||
public Snowflake? SystemChannelId { get; } | |||
/// <summary> | |||
/// System channel flags. | |||
/// </summary> | |||
[JsonPropertyName("system_channel_flags")] | |||
public int SystemChannelFlags { get; } | |||
/// <summary> | |||
/// The id of the channel where Community guilds can display rules and/or guidelines. | |||
/// </summary> | |||
[JsonPropertyName("rules_channel_id")] | |||
public Snowflake? RulesChannelId { get; } | |||
/// <summary> | |||
/// When this guild was joined at. | |||
/// </summary> | |||
[JsonPropertyName("joined_at")] | |||
public Optional<DateTimeOffset> JoinedAt { get; } | |||
/// <summary> | |||
/// True if this is considered a large guild. | |||
/// </summary> | |||
[JsonPropertyName("large")] | |||
public Optional<bool> Large { get; } | |||
/// <summary> | |||
/// True if this guild is unavailable due to an outage. | |||
/// </summary> | |||
[JsonPropertyName("unavailable")] | |||
public Optional<bool> Unavailable { get; } | |||
/// <summary> | |||
/// Total number of members in this guild. | |||
/// </summary> | |||
[JsonPropertyName("member_count")] | |||
public Optional<int> MemberCount { get; } | |||
/// <summary> | |||
/// States of members currently in voice channels; lacks the guild_id key. | |||
/// </summary> | |||
[JsonPropertyName("voice_states")] | |||
public Optional<VoiceState[]> VoiceStates { get; } | |||
/// <summary> | |||
/// Users in the guild. | |||
/// </summary> | |||
[JsonPropertyName("members")] | |||
public Optional<GuildMember[]> Members { get; } | |||
/// <summary> | |||
/// Channels in the guild. | |||
/// </summary> | |||
[JsonPropertyName("channels")] | |||
public Optional<Channel[]> Channels { get; } | |||
/// <summary> | |||
/// All active threads in the guild that current user has permission to view. | |||
/// </summary> | |||
[JsonPropertyName("threads")] | |||
public Optional<Channel[]> Threads { get; } | |||
/// <summary> | |||
/// Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold. | |||
/// </summary> | |||
[JsonPropertyName("presences")] | |||
public Optional<Presence[]> Presences { get; } | |||
/// <summary> | |||
/// The maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned). | |||
/// </summary> | |||
[JsonPropertyName("max_presences")] | |||
public Optional<int?> MaxPresences { get; } | |||
/// <summary> | |||
/// The maximum number of members for the guild. | |||
/// </summary> | |||
[JsonPropertyName("max_members")] | |||
public Optional<int> MaxMembers { get; } | |||
/// <summary> | |||
/// The vanity url code for the guild. | |||
/// </summary> | |||
[JsonPropertyName("vanity_url_code")] | |||
public string? VanityUrlCode { get; } | |||
/// <summary> | |||
/// The description of a Community guild. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; } | |||
/// <summary> | |||
/// Banner hash. | |||
/// </summary> | |||
[JsonPropertyName("banner")] | |||
public string? Banner { get; } | |||
/// <summary> | |||
/// Premium tier (Server Boost level). | |||
/// </summary> | |||
[JsonPropertyName("premium_tier")] | |||
public int PremiumTier { get; } | |||
/// <summary> | |||
/// The number of boosts this guild currently has. | |||
/// </summary> | |||
[JsonPropertyName("premium_subscription_count")] | |||
public Optional<int> PremiumSubscriptionCount { get; } | |||
/// <summary> | |||
/// The preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US". | |||
/// </summary> | |||
[JsonPropertyName("preferred_locale")] | |||
public string PreferredLocale { get; } | |||
/// <summary> | |||
/// The id of the channel where admins and moderators of Community guilds receive notices from Discord. | |||
/// </summary> | |||
[JsonPropertyName("public_updates_channel_id")] | |||
public Snowflake? PublicUpdatesChannelId { get; } | |||
/// <summary> | |||
/// The maximum amount of users in a video channel. | |||
/// </summary> | |||
[JsonPropertyName("max_video_channel_users")] | |||
public Optional<int> MaxVideoChannelUsers { get; } | |||
/// <summary> | |||
/// Approximate number of members in this guild. | |||
/// </summary> | |||
[JsonPropertyName("approximate_member_count")] | |||
public Optional<int> ApproximateMemberCount { get; } | |||
/// <summary> | |||
/// Approximate number of non-offline members in this guild. | |||
/// </summary> | |||
[JsonPropertyName("approximate_presence_count")] | |||
public Optional<int> ApproximatePresenceCount { get; } | |||
/// <summary> | |||
/// The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object. | |||
/// </summary> | |||
[JsonPropertyName("welcome_screen")] | |||
public Optional<WelcomeScreen> WelcomeScreen { get; } | |||
/// <summary> | |||
/// Guild NSFW level. | |||
/// </summary> | |||
[JsonPropertyName("nsfw_level")] | |||
public int NsfwLevel { get; } | |||
/// <summary> | |||
/// Stage instances in the guild. | |||
/// </summary> | |||
[JsonPropertyName("stage_instances")] | |||
public Optional<StageInstance[]> StageInstances { get; } | |||
} | |||
} |
@@ -1,91 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a guild member object. | |||
/// </summary> | |||
public record GuildMember | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="GuildMember"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="user">The user this guild member represents.</param> | |||
/// <param name="nick">This users guild nickname.</param> | |||
/// <param name="roles">Array of role object ids.</param> | |||
/// <param name="joinedAt">When the user joined the guild.</param> | |||
/// <param name="premiumSince">When the user started boosting the guild.</param> | |||
/// <param name="deaf">Whether the user is deafened in voice channels.</param> | |||
/// <param name="mute">Whether the user is muted in voice channels.</param> | |||
/// <param name="pending">Whether the user has not yet passed the guild's Membership Screening requirements.</param> | |||
/// <param name="permissions">Total permissions of the member in the channel, including overwrites, returned when in the interaction object.</param> | |||
[JsonConstructor] | |||
public GuildMember(Optional<User> user, Optional<string?> nick, Snowflake[] roles, DateTimeOffset joinedAt, Optional<DateTimeOffset?> premiumSince, bool deaf, bool mute, Optional<bool> pending, Optional<Permissions> permissions) | |||
{ | |||
User = user; | |||
Nick = nick; | |||
Roles = roles; | |||
JoinedAt = joinedAt; | |||
PremiumSince = premiumSince; | |||
Deaf = deaf; | |||
Mute = mute; | |||
Pending = pending; | |||
Permissions = permissions; | |||
} | |||
/// <summary> | |||
/// The user this guild member represents. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public Optional<User> User { get; } | |||
/// <summary> | |||
/// This users guild nickname. | |||
/// </summary> | |||
[JsonPropertyName("nick")] | |||
public Optional<string?> Nick { get; } | |||
/// <summary> | |||
/// Array of role object ids. | |||
/// </summary> | |||
[JsonPropertyName("roles")] | |||
public Snowflake[] Roles { get; } | |||
/// <summary> | |||
/// When the user joined the guild. | |||
/// </summary> | |||
[JsonPropertyName("joined_at")] | |||
public DateTimeOffset JoinedAt { get; } | |||
/// <summary> | |||
/// When the user started boosting the guild. | |||
/// </summary> | |||
[JsonPropertyName("premium_since")] | |||
public Optional<DateTimeOffset?> PremiumSince { get; } | |||
/// <summary> | |||
/// Whether the user is deafened in voice channels. | |||
/// </summary> | |||
[JsonPropertyName("deaf")] | |||
public bool Deaf { get; } | |||
/// <summary> | |||
/// Whether the user is muted in voice channels. | |||
/// </summary> | |||
[JsonPropertyName("mute")] | |||
public bool Mute { get; } | |||
/// <summary> | |||
/// Whether the user has not yet passed the guild's Membership Screening requirements. | |||
/// </summary> | |||
[JsonPropertyName("pending")] | |||
public Optional<bool> Pending { get; } | |||
/// <summary> | |||
/// Total permissions of the member in the channel, including overwrites, returned when in the interaction object. | |||
/// </summary> | |||
[JsonPropertyName("permissions")] | |||
public Optional<Permissions> Permissions { get; } | |||
} | |||
} |
@@ -1,98 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a guild preview object. | |||
/// </summary> | |||
public record GuildPreview | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="GuildPreview"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Guild id.</param> | |||
/// <param name="name">Guild name (2-100 characters).</param> | |||
/// <param name="icon">Icon hash.</param> | |||
/// <param name="splash">Splash hash.</param> | |||
/// <param name="discoverySplash">Discovery splash hash.</param> | |||
/// <param name="emojis">Custom guild emojis.</param> | |||
/// <param name="features">Enabled guild features.</param> | |||
/// <param name="approximateMemberCount">Approximate number of members in this guild.</param> | |||
/// <param name="approximatePresenceCount">Approximate number of online members in this guild.</param> | |||
/// <param name="description">The description for the guild, if the guild is discoverable.</param> | |||
[JsonConstructor] | |||
public GuildPreview(Snowflake id, string name, string? icon, string? splash, string? discoverySplash, Emoji[] emojis, string[] features, int approximateMemberCount, int approximatePresenceCount, string? description) | |||
{ | |||
Id = id; | |||
Name = name; | |||
Icon = icon; | |||
Splash = splash; | |||
DiscoverySplash = discoverySplash; | |||
Emojis = emojis; | |||
Features = features; | |||
ApproximateMemberCount = approximateMemberCount; | |||
ApproximatePresenceCount = approximatePresenceCount; | |||
Description = description; | |||
} | |||
/// <summary> | |||
/// Guild id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Guild name (2-100 characters). | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// Icon hash. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public string? Icon { get; } | |||
/// <summary> | |||
/// Splash hash. | |||
/// </summary> | |||
[JsonPropertyName("splash")] | |||
public string? Splash { get; } | |||
/// <summary> | |||
/// Discovery splash hash. | |||
/// </summary> | |||
[JsonPropertyName("discovery_splash")] | |||
public string? DiscoverySplash { get; } | |||
/// <summary> | |||
/// Custom guild emojis. | |||
/// </summary> | |||
[JsonPropertyName("emojis")] | |||
public Emoji[] Emojis { get; } | |||
/// <summary> | |||
/// Enabled guild features. | |||
/// </summary> | |||
[JsonPropertyName("features")] | |||
public string[] Features { get; } | |||
/// <summary> | |||
/// Approximate number of members in this guild. | |||
/// </summary> | |||
[JsonPropertyName("approximate_member_count")] | |||
public int ApproximateMemberCount { get; } | |||
/// <summary> | |||
/// Approximate number of online members in this guild. | |||
/// </summary> | |||
[JsonPropertyName("approximate_presence_count")] | |||
public int ApproximatePresenceCount { get; } | |||
/// <summary> | |||
/// The description for the guild, if the guild is discoverable. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; } | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a guild widget object. | |||
/// </summary> | |||
public record GuildWidget | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="GuildWidget"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="enabled">Whether the widget is enabled.</param> | |||
/// <param name="channelId">The widget channel id.</param> | |||
[JsonConstructor] | |||
public GuildWidget(bool enabled, Snowflake? channelId) | |||
{ | |||
Enabled = enabled; | |||
ChannelId = channelId; | |||
} | |||
/// <summary> | |||
/// Whether the widget is enabled. | |||
/// </summary> | |||
[JsonPropertyName("enabled")] | |||
public bool Enabled { get; } | |||
/// <summary> | |||
/// The widget channel id. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake? ChannelId { get; } | |||
} | |||
} |
@@ -1,139 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a integration object. | |||
/// </summary> | |||
public record Integration | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="Integration"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Integration id.</param> | |||
/// <param name="name">Integration name.</param> | |||
/// <param name="type">Integration type (twitch, youtube, or discord).</param> | |||
/// <param name="enabled">Is this integration enabled.</param> | |||
/// <param name="syncing">Is this integration syncing.</param> | |||
/// <param name="roleId">Id that this integration uses for "subscribers".</param> | |||
/// <param name="enableEmoticons">Whether emoticons should be synced for this integration (twitch only currently).</param> | |||
/// <param name="expireBehavior">The behavior of expiring subscribers.</param> | |||
/// <param name="expireGracePeriod">The grace period (in days) before expiring subscribers.</param> | |||
/// <param name="user">User for this integration.</param> | |||
/// <param name="account">Integration account information.</param> | |||
/// <param name="syncedAt">When this integration was last synced.</param> | |||
/// <param name="subscriberCount">How many subscribers this integration has.</param> | |||
/// <param name="revoked">Has this integration been revoked.</param> | |||
/// <param name="application">The bot/OAuth2 application for discord integrations.</param> | |||
[JsonConstructor] | |||
public Integration(Snowflake id, string name, string type, bool enabled, Optional<bool> syncing, Optional<Snowflake> roleId, Optional<bool> enableEmoticons, Optional<IntegrationExpireBehavior> expireBehavior, Optional<int> expireGracePeriod, Optional<User> user, IntegrationAccount account, Optional<DateTimeOffset> syncedAt, Optional<int> subscriberCount, Optional<bool> revoked, Optional<Application> application) | |||
{ | |||
Id = id; | |||
Name = name; | |||
Type = type; | |||
Enabled = enabled; | |||
Syncing = syncing; | |||
RoleId = roleId; | |||
EnableEmoticons = enableEmoticons; | |||
ExpireBehavior = expireBehavior; | |||
ExpireGracePeriod = expireGracePeriod; | |||
User = user; | |||
Account = account; | |||
SyncedAt = syncedAt; | |||
SubscriberCount = subscriberCount; | |||
Revoked = revoked; | |||
Application = application; | |||
} | |||
/// <summary> | |||
/// Integration id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// Integration name. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// Integration type (twitch, youtube, or discord). | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public string Type { get; } | |||
/// <summary> | |||
/// Is this integration enabled. | |||
/// </summary> | |||
[JsonPropertyName("enabled")] | |||
public bool Enabled { get; } | |||
/// <summary> | |||
/// Is this integration syncing. | |||
/// </summary> | |||
[JsonPropertyName("syncing")] | |||
public Optional<bool> Syncing { get; } | |||
/// <summary> | |||
/// Id that this integration uses for "subscribers". | |||
/// </summary> | |||
[JsonPropertyName("role_id")] | |||
public Optional<Snowflake> RoleId { get; } | |||
/// <summary> | |||
/// Whether emoticons should be synced for this integration (twitch only currently). | |||
/// </summary> | |||
[JsonPropertyName("enable_emoticons")] | |||
public Optional<bool> EnableEmoticons { get; } | |||
/// <summary> | |||
/// The behavior of expiring subscribers. | |||
/// </summary> | |||
[JsonPropertyName("expire_behavior")] | |||
public Optional<IntegrationExpireBehavior> ExpireBehavior { get; } | |||
/// <summary> | |||
/// The grace period (in days) before expiring subscribers. | |||
/// </summary> | |||
[JsonPropertyName("expire_grace_period")] | |||
public Optional<int> ExpireGracePeriod { get; } | |||
/// <summary> | |||
/// User for this integration. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public Optional<User> User { get; } | |||
/// <summary> | |||
/// Integration account information. | |||
/// </summary> | |||
[JsonPropertyName("account")] | |||
public IntegrationAccount Account { get; } | |||
/// <summary> | |||
/// When this integration was last synced. | |||
/// </summary> | |||
[JsonPropertyName("synced_at")] | |||
public Optional<DateTimeOffset> SyncedAt { get; } | |||
/// <summary> | |||
/// How many subscribers this integration has. | |||
/// </summary> | |||
[JsonPropertyName("subscriber_count")] | |||
public Optional<int> SubscriberCount { get; } | |||
/// <summary> | |||
/// Has this integration been revoked. | |||
/// </summary> | |||
[JsonPropertyName("revoked")] | |||
public Optional<bool> Revoked { get; } | |||
/// <summary> | |||
/// The bot/OAuth2 application for discord integrations. | |||
/// </summary> | |||
[JsonPropertyName("application")] | |||
public Optional<Application> Application { get; } | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a integration account object. | |||
/// </summary> | |||
public record IntegrationAccount | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="IntegrationAccount"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">Id of the account.</param> | |||
/// <param name="name">Name of the account.</param> | |||
[JsonConstructor] | |||
public IntegrationAccount(string id, string name) | |||
{ | |||
Id = id; | |||
Name = name; | |||
} | |||
/// <summary> | |||
/// Id of the account. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public string Id { get; } | |||
/// <summary> | |||
/// Name of the account. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
} | |||
} |
@@ -1,66 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a integration application object. | |||
/// </summary> | |||
public record IntegrationApplication | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="IntegrationApplication"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="id">The id of the app.</param> | |||
/// <param name="name">The name of the app.</param> | |||
/// <param name="icon">The icon hash of the app.</param> | |||
/// <param name="description">The description of the app.</param> | |||
/// <param name="summary">The description of the app.</param> | |||
/// <param name="bot">The bot associated with this application.</param> | |||
[JsonConstructor] | |||
public IntegrationApplication(Snowflake id, string name, string? icon, string description, string summary, Optional<User> bot) | |||
{ | |||
Id = id; | |||
Name = name; | |||
Icon = icon; | |||
Description = description; | |||
Summary = summary; | |||
Bot = bot; | |||
} | |||
/// <summary> | |||
/// The id of the app. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; } | |||
/// <summary> | |||
/// The name of the app. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// The icon hash of the app. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public string? Icon { get; } | |||
/// <summary> | |||
/// The description of the app. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string Description { get; } | |||
/// <summary> | |||
/// The description of the app. | |||
/// </summary> | |||
[JsonPropertyName("summary")] | |||
public string Summary { get; } | |||
/// <summary> | |||
/// The bot associated with this application. | |||
/// </summary> | |||
[JsonPropertyName("bot")] | |||
public Optional<User> Bot { get; } | |||
} | |||
} |
@@ -1,20 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the integration expire behavior. | |||
/// </summary> | |||
public enum IntegrationExpireBehavior | |||
{ | |||
/// <summary> | |||
/// It will remove the role. | |||
/// </summary> | |||
RemoveRole = 0, | |||
/// <summary> | |||
/// It will kick the member. | |||
/// </summary> | |||
Kick = 1, | |||
} | |||
} |
@@ -1,20 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the m f a level. | |||
/// </summary> | |||
public enum MfaLevel | |||
{ | |||
/// <summary> | |||
/// Guild has no MFA/2FA requirement for moderation actions. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// Guild has a 2FA requirement for moderation actions. | |||
/// </summary> | |||
Elevated = 1, | |||
} | |||
} |
@@ -1,30 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the premium tier. | |||
/// </summary> | |||
public enum PremiumTier | |||
{ | |||
/// <summary> | |||
/// Guild has not unlocked any Server Boost perks. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// Guild has unlocked Server Boost level 1 perks. | |||
/// </summary> | |||
Tier1 = 1, | |||
/// <summary> | |||
/// Guild has unlocked Server Boost level 2 perks. | |||
/// </summary> | |||
Tier2 = 2, | |||
/// <summary> | |||
/// Guild has unlocked Server Boost level 3 perks. | |||
/// </summary> | |||
Tier3 = 3, | |||
} | |||
} |
@@ -1,35 +0,0 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the verification level. | |||
/// </summary> | |||
public enum VerificationLevel | |||
{ | |||
/// <summary> | |||
/// Unrestricted. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// Must have verified email on account. | |||
/// </summary> | |||
Low = 1, | |||
/// <summary> | |||
/// Must be registered on Discord for longer than 5 minutes. | |||
/// </summary> | |||
Medium = 2, | |||
/// <summary> | |||
/// Must be a member of the server for longer than 10 minutes. | |||
/// </summary> | |||
High = 3, | |||
/// <summary> | |||
/// Must have a verified phone number. | |||
/// </summary> | |||
VeryHigh = 4, | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a welcome screen object. | |||
/// </summary> | |||
public record WelcomeScreen | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="WelcomeScreen"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="description">The server description shown in the welcome screen.</param> | |||
/// <param name="welcomeChannels">The channels shown in the welcome screen, up to 5.</param> | |||
[JsonConstructor] | |||
public WelcomeScreen(string? description, WelcomeScreenChannel[] welcomeChannels) | |||
{ | |||
Description = description; | |||
WelcomeChannels = welcomeChannels; | |||
} | |||
/// <summary> | |||
/// The server description shown in the welcome screen. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; } | |||
/// <summary> | |||
/// The channels shown in the welcome screen, up to 5. | |||
/// </summary> | |||
[JsonPropertyName("welcome_channels")] | |||
public WelcomeScreenChannel[] WelcomeChannels { get; } | |||
} | |||
} |
@@ -1,50 +0,0 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a welcome screen channel object. | |||
/// </summary> | |||
public record WelcomeScreenChannel | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="WelcomeScreenChannel"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="channelId">The channel's id.</param> | |||
/// <param name="description">The description shown for the channel.</param> | |||
/// <param name="emojiId">The emoji id, if the emoji is custom.</param> | |||
/// <param name="emojiName">The emoji name if custom, the unicode character if standard, or null if no emoji is set.</param> | |||
[JsonConstructor] | |||
public WelcomeScreenChannel(Snowflake channelId, string description, Snowflake? emojiId, string? emojiName) | |||
{ | |||
ChannelId = channelId; | |||
Description = description; | |||
EmojiId = emojiId; | |||
EmojiName = emojiName; | |||
} | |||
/// <summary> | |||
/// The channel's id. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake ChannelId { get; } | |||
/// <summary> | |||
/// The description shown for the channel. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string Description { get; } | |||
/// <summary> | |||
/// The emoji id, if the emoji is custom. | |||
/// </summary> | |||
[JsonPropertyName("emoji_id")] | |||
public Snowflake? EmojiId { get; } | |||
/// <summary> | |||
/// The emoji name if custom, the unicode character if standard, or null if no emoji is set. | |||
/// </summary> | |||
[JsonPropertyName("emoji_name")] | |||
public string? EmojiName { get; } | |||
} | |||
} |
@@ -1,107 +0,0 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a guild template object. | |||
/// </summary> | |||
public record GuildTemplate | |||
{ | |||
/// <summary> | |||
/// Creates a <see cref="GuildTemplate"/> with the provided parameters. | |||
/// </summary> | |||
/// <param name="code">The template code (unique ID).</param> | |||
/// <param name="name">Template name.</param> | |||
/// <param name="description">The description for the template.</param> | |||
/// <param name="usageCount">Number of times this template has been used.</param> | |||
/// <param name="creatorId">The ID of the user who created the template.</param> | |||
/// <param name="creator">The user who created the template.</param> | |||
/// <param name="createdAt">When this template was created.</param> | |||
/// <param name="updatedAt">When this template was last synced to the source guild.</param> | |||
/// <param name="sourceGuildId">The ID of the guild this template is based on.</param> | |||
/// <param name="serializedSourceGuild">The guild snapshot this template contains.</param> | |||
/// <param name="isDirty">Whether the template has unsynced changes.</param> | |||
[JsonConstructor] | |||
public GuildTemplate(string code, string name, string? description, int usageCount, Snowflake creatorId, User creator, DateTimeOffset createdAt, DateTimeOffset updatedAt, Snowflake sourceGuildId, Guild serializedSourceGuild, bool? isDirty) | |||
{ | |||
Code = code; | |||
Name = name; | |||
Description = description; | |||
UsageCount = usageCount; | |||
CreatorId = creatorId; | |||
Creator = creator; | |||
CreatedAt = createdAt; | |||
UpdatedAt = updatedAt; | |||
SourceGuildId = sourceGuildId; | |||
SerializedSourceGuild = serializedSourceGuild; | |||
IsDirty = isDirty; | |||
} | |||
/// <summary> | |||
/// The template code (unique ID). | |||
/// </summary> | |||
[JsonPropertyName("code")] | |||
public string Code { get; } | |||
/// <summary> | |||
/// Template name. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string Name { get; } | |||
/// <summary> | |||
/// The description for the template. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; } | |||
/// <summary> | |||
/// Number of times this template has been used. | |||
/// </summary> | |||
[JsonPropertyName("usage_count")] | |||
public int UsageCount { get; } | |||
/// <summary> | |||
/// The ID of the user who created the template. | |||
/// </summary> | |||
[JsonPropertyName("creator_id")] | |||
public Snowflake CreatorId { get; } | |||
/// <summary> | |||
/// The user who created the template. | |||
/// </summary> | |||
[JsonPropertyName("creator")] | |||
public User Creator { get; } | |||
/// <summary> | |||
/// When this template was created. | |||
/// </summary> | |||
[JsonPropertyName("created_at")] | |||
public DateTimeOffset CreatedAt { get; } | |||
/// <summary> | |||
/// When this template was last synced to the source guild. | |||
/// </summary> | |||
[JsonPropertyName("updated_at")] | |||
public DateTimeOffset UpdatedAt { get; } | |||
/// <summary> | |||
/// The ID of the guild this template is based on. | |||
/// </summary> | |||
[JsonPropertyName("source_guild_id")] | |||
public Snowflake SourceGuildId { get; } | |||
/// <summary> | |||
/// The guild snapshot this template contains. | |||
/// </summary> | |||
[JsonPropertyName("serialized_source_guild")] | |||
public Guild SerializedSourceGuild { get; } | |||
/// <summary> | |||
/// Whether the template has unsynced changes. | |||
/// </summary> | |||
[JsonPropertyName("is_dirty")] | |||
public bool? IsDirty { get; } | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord ban object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#ban-object-ban-structure"/> | |||
/// </remarks> | |||
public record Ban | |||
{ | |||
/// <summary> | |||
/// The reason for the ban. | |||
/// </summary> | |||
[JsonPropertyName("reason")] | |||
public string? Reason { get; init; } | |||
/// <summary> | |||
/// The banned <see cref="Models.User"/>. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public User? User { get; init; } // Required property candidate | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the default message notification level for a <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level"/> | |||
/// </remarks> | |||
public enum DefaultMessageNotificationLevel | |||
{ | |||
/// <summary> | |||
/// <see cref="GuildMember"/>s will receive notifications for all <see cref="Message"/>s by default. | |||
/// </summary> | |||
AllMessages = 0, | |||
/// <summary> | |||
/// <see cref="GuildMember"/>s will receive notifications only for <see cref="Message"/>s that @mention them by default. | |||
/// </summary> | |||
OnlyMentions = 1, | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the explicit content filter level for a <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level"/> | |||
/// </remarks> | |||
public enum ExplicitContentFilterLevel | |||
{ | |||
/// <summary> | |||
/// Media content will not be scanned. | |||
/// </summary> | |||
Disabled = 0, | |||
/// <summary> | |||
/// Media content sent by <see cref="GuildMember"/>s without | |||
/// <see cref="Role"/>s will be scanned. | |||
/// </summary> | |||
MembersWithoutRoles = 1, | |||
/// <summary> | |||
/// Media content sent by all <see cref="GuildMember"/>s will be scanned. | |||
/// </summary> | |||
AllMembers = 2, | |||
} | |||
} |
@@ -0,0 +1,325 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord guild object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-object-guild-structure"/> | |||
/// </remarks> | |||
public record Guild | |||
{ | |||
/// <summary> | |||
/// <see cref="Guild"/> id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; init; } | |||
/// <summary> | |||
/// <see cref="Guild"/> name. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Icon hash. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public string? Icon { get; init; } | |||
/// <summary> | |||
/// Icon hash, returned when in the template object. | |||
/// </summary> | |||
[JsonPropertyName("icon_hash")] | |||
public Optional<string?> IconHash { get; init; } | |||
/// <summary> | |||
/// Splash hash. | |||
/// </summary> | |||
[JsonPropertyName("splash")] | |||
public string? Splash { get; init; } | |||
/// <summary> | |||
/// Discovery splash hash; only present for <see cref="Guild"/>s | |||
/// with the "DISCOVERABLE" feature. | |||
/// </summary> | |||
[JsonPropertyName("discovery_splash")] | |||
public string? DiscoverySplash { get; init; } | |||
/// <summary> | |||
/// True if the <see cref="User"/> is the owner of the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("owner")] | |||
public Optional<bool> Owner { get; init; } | |||
/// <summary> | |||
/// Id of owner. | |||
/// </summary> | |||
[JsonPropertyName("owner_id")] | |||
public Snowflake OwnerId { get; init; } | |||
/// <summary> | |||
/// <see cref="Models.Permissions"/> for the <see cref="User"/> in the | |||
/// <see cref="Guild"/> (excludes overwrites). | |||
/// </summary> | |||
[JsonPropertyName("permissions")] | |||
public Optional<Permissions> Permissions { get; init; } | |||
/// <summary> | |||
/// Voice region id for the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("region")] | |||
public string? Region { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Id of afk <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("afk_channel_id")] | |||
public Snowflake? AfkChannelId { get; init; } | |||
/// <summary> | |||
/// Afk timeout in seconds. | |||
/// </summary> | |||
[JsonPropertyName("afk_timeout")] | |||
public int AfkTimeout { get; init; } | |||
/// <summary> | |||
/// True if the server widget is enabled. | |||
/// </summary> | |||
[JsonPropertyName("widget_enabled")] | |||
public Optional<bool> WidgetEnabled { get; init; } | |||
/// <summary> | |||
/// The <see cref="Channel"/> id that the widget will generate an invite to, or null if set to no invite. | |||
/// </summary> | |||
[JsonPropertyName("widget_channel_id")] | |||
public Optional<Snowflake?> WidgetChannelId { get; init; } | |||
/// <summary> | |||
/// Verification level required for the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("verification_level")] | |||
public VerificationLevel VerificationLevel { get; init; } | |||
/// <summary> | |||
/// Default message notifications level. | |||
/// </summary> | |||
[JsonPropertyName("default_message_notifications")] | |||
public DefaultMessageNotificationLevel DefaultMessageNotifications { get; init; } | |||
/// <summary> | |||
/// Explicit content filter level. | |||
/// </summary> | |||
[JsonPropertyName("explicit_content_filter")] | |||
public ExplicitContentFilterLevel ExplicitContentFilter { get; init; } | |||
/// <summary> | |||
/// <see cref="Role"/>s in the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("roles")] | |||
public Role[]? Roles { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Custom <see cref="Guild"/> <see cref="Emoji"/>s. | |||
/// </summary> | |||
[JsonPropertyName("emojis")] | |||
public Emoji[]? Emojis { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Enabled <see cref="Guild"/> features. | |||
/// </summary> | |||
[JsonPropertyName("features")] | |||
public string[]? Features { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Required MFA level for the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("mfa_level")] | |||
public MfaLevel MfaLevel { get; init; } | |||
/// <summary> | |||
/// <see cref="Application"/> id of the <see cref="Guild"/> creator if it is bot-created. | |||
/// </summary> | |||
[JsonPropertyName("application_id")] | |||
public Snowflake? ApplicationId { get; init; } | |||
/// <summary> | |||
/// The id of the <see cref="Channel"/> where <see cref="Guild"/> notices such | |||
/// as welcome messages and boost events are posted. | |||
/// </summary> | |||
[JsonPropertyName("system_channel_id")] | |||
public Snowflake? SystemChannelId { get; init; } | |||
/// <summary> | |||
/// System <see cref="Channel"/> flags. | |||
/// </summary> | |||
[JsonPropertyName("system_channel_flags")] | |||
public int SystemChannelFlags { get; init; } | |||
/// <summary> | |||
/// The id of the <see cref="Channel"/> where Community <see cref="Guild"/>s | |||
/// can display rules and/or guidelines. | |||
/// </summary> | |||
[JsonPropertyName("rules_channel_id")] | |||
public Snowflake? RulesChannelId { get; init; } | |||
/// <summary> | |||
/// When this <see cref="Guild"/> was joined at. | |||
/// </summary> | |||
[JsonPropertyName("joined_at")] | |||
public Optional<DateTimeOffset> JoinedAt { get; init; } | |||
/// <summary> | |||
/// True if this is considered a large <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("large")] | |||
public Optional<bool> Large { get; init; } | |||
/// <summary> | |||
/// True if this <see cref="Guild"/> is unavailable due to an outage. | |||
/// </summary> | |||
[JsonPropertyName("unavailable")] | |||
public Optional<bool> Unavailable { get; init; } | |||
/// <summary> | |||
/// Total number of <see cref="GuildMember"/>s in this <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("member_count")] | |||
public Optional<int> MemberCount { get; init; } | |||
/// <summary> | |||
/// States of <see cref="GuildMember"/>s currently in voice <see cref="Channel"/>s. | |||
/// </summary> | |||
/// <remarks> | |||
/// Lacks the <see cref="VoiceState.GuildId"/>. | |||
/// </remarks> | |||
[JsonPropertyName("voice_states")] | |||
public Optional<VoiceState[]> VoiceStates { get; init; } | |||
/// <summary> | |||
/// <see cref="GuildMember"/>s in the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("members")] | |||
public Optional<GuildMember[]> Members { get; init; } | |||
/// <summary> | |||
/// <see cref="Channel"/>s in the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("channels")] | |||
public Optional<Channel[]> Channels { get; init; } | |||
/// <summary> | |||
/// All active thread <see cref="Channel"/>s in the <see cref="Guild"/> that current <see cref="User"/> | |||
/// has permission to view. | |||
/// </summary> | |||
[JsonPropertyName("threads")] | |||
public Optional<Channel[]> Threads { get; init; } | |||
/// <summary> | |||
/// <see cref="Presence"/>s of the <see cref="GuildMember"/>s in the <see cref="Guild"/>, | |||
/// will only include non-offline <see cref="GuildMember"/>s if the size is greater than large threshold. | |||
/// </summary> | |||
[JsonPropertyName("presences")] | |||
public Optional<Presence[]> Presences { get; init; } | |||
/// <summary> | |||
/// The maximum number of <see cref="Presences"/> for the <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// The default value, currently 25000, is in effect when null is returned. | |||
/// </remarks> | |||
[JsonPropertyName("max_presences")] | |||
public Optional<int?> MaxPresences { get; init; } | |||
/// <summary> | |||
/// The maximum number of <see cref="GuildMember"/>s for the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("max_members")] | |||
public Optional<int> MaxMembers { get; init; } | |||
/// <summary> | |||
/// The vanity url code for the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("vanity_url_code")] | |||
public string? VanityUrlCode { get; init; } | |||
/// <summary> | |||
/// The description of a Community <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; init; } | |||
/// <summary> | |||
/// Banner hash. | |||
/// </summary> | |||
[JsonPropertyName("banner")] | |||
public string? Banner { get; init; } | |||
/// <summary> | |||
/// Premium tier (Server Boost level). | |||
/// </summary> | |||
[JsonPropertyName("premium_tier")] | |||
public PremiumTier PremiumTier { get; init; } | |||
/// <summary> | |||
/// The number of boosts this <see cref="Guild"/> currently has. | |||
/// </summary> | |||
[JsonPropertyName("premium_subscription_count")] | |||
public Optional<int> PremiumSubscriptionCount { get; init; } | |||
/// <summary> | |||
/// The preferred locale of a Community <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// Used in server discovery and notices from Discord, defaults to "en-US". | |||
/// </remarks> | |||
[JsonPropertyName("preferred_locale")] | |||
public string? PreferredLocale { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The id of the <see cref="Channel"/> where admins and moderators of Community | |||
/// <see cref="Guild"/> receive notices from Discord. | |||
/// </summary> | |||
[JsonPropertyName("public_updates_channel_id")] | |||
public Snowflake? PublicUpdatesChannelId { get; init; } | |||
/// <summary> | |||
/// The maximum amount of <see cref="User"/>s in a video <see cref="Channel"/>. | |||
/// </summary> | |||
[JsonPropertyName("max_video_channel_users")] | |||
public Optional<int> MaxVideoChannelUsers { get; init; } | |||
/// <summary> | |||
/// Approximate number of <see cref="GuildMember"/>s in this <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("approximate_member_count")] | |||
public Optional<int> ApproximateMemberCount { get; init; } | |||
/// <summary> | |||
/// Approximate number of non-offline <see cref="GuildMember"/>s in this <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("approximate_presence_count")] | |||
public Optional<int> ApproximatePresenceCount { get; init; } | |||
/// <summary> | |||
/// The welcome screen of a Community <see cref="Guild"/>, shown to new <see cref="GuildMember"/>s, | |||
/// returned in <see cref="Invite.Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("welcome_screen")] | |||
public Optional<WelcomeScreen> WelcomeScreen { get; init; } | |||
/// <summary> | |||
/// Guild NSFW level. | |||
/// </summary> | |||
[JsonPropertyName("nsfw_level")] | |||
public GuildNsfwLevel NsfwLevel { get; init; } | |||
/// <summary> | |||
/// <see cref="StageInstance"/>s in the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("stage_instances")] | |||
public Optional<StageInstance[]> StageInstances { get; init; } | |||
} | |||
} |
@@ -0,0 +1,71 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord guild member object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure"/> | |||
/// </remarks> | |||
public record GuildMember | |||
{ | |||
/// <summary> | |||
/// The <see cref="Models.User"/> this <see cref="GuildMember"/> represents. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public Optional<User> User { get; init; } | |||
/// <summary> | |||
/// This users <see cref="Guild"/> nickname. | |||
/// </summary> | |||
[JsonPropertyName("nick")] | |||
public Optional<string?> Nick { get; init; } | |||
/// <summary> | |||
/// Array of <see cref="Role"/> ids. | |||
/// </summary> | |||
[JsonPropertyName("roles")] | |||
public Snowflake[]? Roles { get; init; } // Required property candidate | |||
/// <summary> | |||
/// When the user joined the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("joined_at")] | |||
public DateTimeOffset JoinedAt { get; init; } | |||
/// <summary> | |||
/// When the user started boosting the <see cref="Guild"/>. | |||
/// </summary> | |||
[JsonPropertyName("premium_since")] | |||
public Optional<DateTimeOffset?> PremiumSince { get; init; } | |||
/// <summary> | |||
/// Whether the user is deafened in voice <see cref="Channel"/>s. | |||
/// </summary> | |||
[JsonPropertyName("deaf")] | |||
public bool Deaf { get; init; } | |||
/// <summary> | |||
/// Whether the user is muted in voice <see cref="Channel"/>s. | |||
/// </summary> | |||
[JsonPropertyName("mute")] | |||
public bool Mute { get; init; } | |||
/// <summary> | |||
/// Whether the user has not yet passed the <see cref="Guild"/>'s | |||
/// Membership Screening requirements. | |||
/// </summary> | |||
[JsonPropertyName("pending")] | |||
public Optional<bool> Pending { get; init; } | |||
/// <summary> | |||
/// Total <see cref="Models.Permissions"/> of the <see cref="GuildMember"/> | |||
/// in the <see cref="Channel"/>, including <see cref="Overwrite"/>s, returned | |||
/// when in the interaction object. | |||
/// </summary> | |||
[JsonPropertyName("permissions")] | |||
public Optional<Permissions> Permissions { get; init; } | |||
} | |||
} |
@@ -1,29 +1,27 @@ | |||
using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the guild NSFW level. | |||
/// Declares an enum which represents the guild nsfw level for a <see cref="Guild"/>. | |||
/// </summary> | |||
public enum GuildNsfwLevel | |||
{ | |||
/// <summary> | |||
/// Default level. | |||
/// Default level. | |||
/// </summary> | |||
Default = 0, | |||
/// <summary> | |||
/// Guild contains explicit content. | |||
/// Guild has explicit content. | |||
/// </summary> | |||
Explicit = 1, | |||
/// <summary> | |||
/// Guild is safe for work. | |||
/// Guild is safe for work. | |||
/// </summary> | |||
Safe = 2, | |||
/// <summary> | |||
/// Guild has an age restriction. | |||
/// Guild is age-restricted. | |||
/// </summary> | |||
AgeRestricted = 3, | |||
} |
@@ -0,0 +1,80 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord guild template object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild-template#guild-template-object-guild-template-structure"/> | |||
/// </remarks> | |||
public record GuildTemplate | |||
{ | |||
/// <summary> | |||
/// The template code (unique ID). | |||
/// </summary> | |||
[JsonPropertyName("code")] | |||
public string? Code { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Template name. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The description for the template. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; init; } | |||
/// <summary> | |||
/// Number of times this template has been used. | |||
/// </summary> | |||
[JsonPropertyName("usage_count")] | |||
public int UsageCount { get; init; } | |||
/// <summary> | |||
/// The ID of the user who created the template. | |||
/// </summary> | |||
[JsonPropertyName("creator_id")] | |||
public Snowflake CreatorId { get; init; } | |||
/// <summary> | |||
/// The user who created the template. | |||
/// </summary> | |||
[JsonPropertyName("creator")] | |||
public User? Creator { get; init; } // Required property candidate | |||
/// <summary> | |||
/// When this template was created. | |||
/// </summary> | |||
[JsonPropertyName("created_at")] | |||
public DateTimeOffset CreatedAt { get; init; } | |||
/// <summary> | |||
/// When this template was last synced to the source guild. | |||
/// </summary> | |||
[JsonPropertyName("updated_at")] | |||
public DateTimeOffset UpdatedAt { get; init; } | |||
/// <summary> | |||
/// The ID of the <see cref="Guild"/> this template is based on. | |||
/// </summary> | |||
[JsonPropertyName("source_guild_id")] | |||
public Snowflake SourceGuildId { get; init; } | |||
/// <summary> | |||
/// The <see cref="Guild"/> snapshot this template contains. | |||
/// </summary> | |||
[JsonPropertyName("serialized_source_guild")] | |||
public Guild? SerializedSourceGuild { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Whether the template has unsynced changes. | |||
/// </summary> | |||
[JsonPropertyName("is_dirty")] | |||
public bool? IsDirty { get; init; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord guild widget object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure"/> | |||
/// </remarks> | |||
public record GuildWidget | |||
{ | |||
/// <summary> | |||
/// Whether the widget is enabled. | |||
/// </summary> | |||
[JsonPropertyName("enabled")] | |||
public bool Enabled { get; init; } | |||
/// <summary> | |||
/// The widget <see cref="Channel"/> id. | |||
/// </summary> | |||
[JsonPropertyName("channel_id")] | |||
public Snowflake? ChannelId { get; init; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the mfa/2fa level for a <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-object-mfa-level"/> | |||
/// </remarks> | |||
public enum MfaLevel | |||
{ | |||
/// <summary> | |||
/// <see cref="Guild"/> has no MFA/2FA requirement for moderation actions. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// <see cref="Guild"/> has a 2FA requirement for moderation actions. | |||
/// </summary> | |||
Elevated = 1, | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the premium tier (server boost tier) for a <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-object-premium-tier"/> | |||
/// </remarks> | |||
public enum PremiumTier | |||
{ | |||
/// <summary> | |||
/// <see cref="Guild"/> has not unlocked any Server Boost perks. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// <see cref="Guild"/> has unlocked Server Boost level 1 perks. | |||
/// </summary> | |||
Tier1 = 1, | |||
/// <summary> | |||
/// <see cref="Guild"/> has unlocked Server Boost level 2 perks. | |||
/// </summary> | |||
Tier2 = 2, | |||
/// <summary> | |||
/// <see cref="Guild"/> has unlocked Server Boost level 3 perks. | |||
/// </summary> | |||
Tier3 = 3, | |||
} | |||
} |
@@ -3,23 +3,26 @@ using System; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents the system channel flags. | |||
/// Declares a flag enum which represents the system channel flags for a <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags"/> | |||
/// </remarks> | |||
[Flags] | |||
public enum SystemChannelFlags | |||
{ | |||
/// <summary> | |||
/// Suppress member join notifications. | |||
/// Suppress member join notifications. | |||
/// </summary> | |||
SuppressJoinNotifications = 1 << 0, | |||
/// <summary> | |||
/// Suppress server boost notifications. | |||
/// Suppress server boost notifications. | |||
/// </summary> | |||
SuppressPremiumSubscriptions = 1 << 1, | |||
/// <summary> | |||
/// Suppress server setup tips. | |||
/// Suppress server setup tips. | |||
/// </summary> | |||
SuppressGuildReminderNotifications = 1 << 2, | |||
} |
@@ -0,0 +1,36 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the verification level for a <see cref="Guild"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#guild-object-verification-level"/> | |||
/// </remarks> | |||
public enum VerificationLevel | |||
{ | |||
/// <summary> | |||
/// Unrestricted. | |||
/// </summary> | |||
None = 0, | |||
/// <summary> | |||
/// Must have verified email on account. | |||
/// </summary> | |||
Low = 1, | |||
/// <summary> | |||
/// Must be registered on Discord for longer than 5 minutes. | |||
/// </summary> | |||
Medium = 2, | |||
/// <summary> | |||
/// Must be a <see cref="GuildMember"/> of the server for longer than 10 minutes. | |||
/// </summary> | |||
High = 3, | |||
/// <summary> | |||
/// Must have a verified phone number. | |||
/// </summary> | |||
VeryHigh = 4, | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord welcome screen object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure"/> | |||
/// </remarks> | |||
public record WelcomeScreen | |||
{ | |||
/// <summary> | |||
/// The <see cref="Guild.Description"/> shown in the <see cref="WelcomeScreen"/>. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; init; } | |||
/// <summary> | |||
/// The <see cref="WelcomeScreenChannel"/>s shown in the <see cref="WelcomeScreen"/>, up to 5. | |||
/// </summary> | |||
[JsonPropertyName("welcome_channels")] | |||
public WelcomeScreenChannel[]? WelcomeChannels { get; init; } // Required property candidate | |||
} | |||
} |
@@ -0,0 +1,104 @@ | |||
using System; | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord integration object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#integration-object-integration-structure"/> | |||
/// </remarks> | |||
public record Integration | |||
{ | |||
/// <summary> | |||
/// <see cref="Integration"/> id. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; init; } | |||
/// <summary> | |||
/// <see cref="Integration"/> name. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; init; } // Required property candidate | |||
/// <summary> | |||
/// <see cref="Integration"/> type (twitch, youtube, or discord). | |||
/// </summary> | |||
[JsonPropertyName("type")] | |||
public string? Type { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Returns if this <see cref="Integration"/> is enabled. | |||
/// </summary> | |||
[JsonPropertyName("enabled")] | |||
public bool Enabled { get; init; } | |||
/// <summary> | |||
/// Returns if this <see cref="Integration"/> is syncing. | |||
/// </summary> | |||
[JsonPropertyName("syncing")] | |||
public Optional<bool> Syncing { get; init; } | |||
/// <summary> | |||
/// Id that this <see cref="Integration"/> uses for "subscribers". | |||
/// </summary> | |||
[JsonPropertyName("role_id")] | |||
public Optional<Snowflake> RoleId { get; init; } | |||
/// <summary> | |||
/// Whether emoticons should be synced for this <see cref="Integration"/> (twitch only currently). | |||
/// </summary> | |||
[JsonPropertyName("enable_emoticons")] | |||
public Optional<bool> EnableEmoticons { get; init; } | |||
/// <summary> | |||
/// The behavior of expiring subscribers. | |||
/// </summary> | |||
[JsonPropertyName("expire_behavior")] | |||
public Optional<IntegrationExpireBehavior> ExpireBehavior { get; init; } | |||
/// <summary> | |||
/// The grace period (in days) before expiring subscribers. | |||
/// </summary> | |||
[JsonPropertyName("expire_grace_period")] | |||
public Optional<int> ExpireGracePeriod { get; init; } | |||
/// <summary> | |||
/// <see cref="User"/> for this <see cref="Integration"/>. | |||
/// </summary> | |||
[JsonPropertyName("user")] | |||
public Optional<User> User { get; init; } | |||
/// <summary> | |||
/// <see cref="IntegrationAccount"/> information. | |||
/// </summary> | |||
[JsonPropertyName("account")] | |||
public IntegrationAccount? Account { get; init; } // Required property candidate | |||
/// <summary> | |||
/// When this <see cref="Integration"/> was last synced. | |||
/// </summary> | |||
[JsonPropertyName("synced_at")] | |||
public Optional<DateTimeOffset> SyncedAt { get; init; } | |||
/// <summary> | |||
/// How many subscribers this <see cref="Integration"/> has. | |||
/// </summary> | |||
[JsonPropertyName("subscriber_count")] | |||
public Optional<int> SubscriberCount { get; init; } | |||
/// <summary> | |||
/// Has this <see cref="Integration"/> been revoked. | |||
/// </summary> | |||
[JsonPropertyName("revoked")] | |||
public Optional<bool> Revoked { get; init; } | |||
/// <summary> | |||
/// The bot/OAuth2 <see cref="Models.Application"/> for discord integrations. | |||
/// </summary> | |||
[JsonPropertyName("application")] | |||
public Optional<Application> Application { get; init; } | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord integration account object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure"/> | |||
/// </remarks> | |||
public record IntegrationAccount | |||
{ | |||
/// <summary> | |||
/// Id of the account. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public string? Id { get; init; } // Required property candidate | |||
/// <summary> | |||
/// Name of the account. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; init; } // Required property candidate | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
using System.Text.Json.Serialization; | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Represents a discord integration application object. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure"/> | |||
/// </remarks> | |||
public record IntegrationApplication | |||
{ | |||
/// <summary> | |||
/// The id of the <see cref="IntegrationApplication"/>. | |||
/// </summary> | |||
[JsonPropertyName("id")] | |||
public Snowflake Id { get; init; } | |||
/// <summary> | |||
/// The name of the <see cref="IntegrationApplication"/>. | |||
/// </summary> | |||
[JsonPropertyName("name")] | |||
public string? Name { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The icon hash of the <see cref="IntegrationApplication"/>. | |||
/// </summary> | |||
[JsonPropertyName("icon")] | |||
public string? Icon { get; init; } | |||
/// <summary> | |||
/// The description of the <see cref="IntegrationApplication"/>. | |||
/// </summary> | |||
[JsonPropertyName("description")] | |||
public string? Description { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The summary of the <see cref="IntegrationApplication"/>. | |||
/// </summary> | |||
[JsonPropertyName("summary")] | |||
public string? Summary { get; init; } // Required property candidate | |||
/// <summary> | |||
/// The <see cref="User"/> bot associated with this <see cref="IntegrationApplication"/>. | |||
/// </summary> | |||
[JsonPropertyName("bot")] | |||
public Optional<User> Bot { get; init; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the integration expire behavior for an <see cref="Integration"/>. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure"/> | |||
/// </remarks> | |||
public enum IntegrationExpireBehavior | |||
{ | |||
/// <summary> | |||
/// It will remove the role. | |||
/// </summary> | |||
RemoveRole = 0, | |||
/// <summary> | |||
/// It will kick the member. | |||
/// </summary> | |||
Kick = 1, | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
namespace Discord.Net.Models | |||
{ | |||
/// <summary> | |||
/// Declares an enum which represents the type of interaction. | |||
/// </summary> | |||
/// <remarks> | |||
/// <see href="https://discord.com/developers/docs/interactions/slash-commands#interaction-interactiontype"/> | |||
/// </remarks> | |||
public enum InteractionType | |||
{ | |||
/// <summary> | |||
/// Received when registering an interaction, replied with a pong. | |||
/// </summary> | |||
Ping = 1, | |||
/// <summary> | |||
/// This interaction is from a slash command. | |||
/// </summary> | |||
ApplicationCommand = 2, | |||
/// <summary> | |||
/// This interaction is from a <see cref="Component"/>. | |||
/// </summary> | |||
MessageComponent = 3, | |||
} | |||
} |