@@ -22,12 +22,13 @@ | |||||
<!-- Package versions for package references across all projects --> | <!-- Package versions for package references across all projects --> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Update="coverlet.collector" Version="3.0.3" /> | <PackageReference Update="coverlet.collector" Version="3.0.3" /> | ||||
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.10.0-3.final" /> | |||||
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.10.0" /> | |||||
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" /> | |||||
<PackageReference Update="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" /> | <PackageReference Update="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" /> | ||||
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" /> | <PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" /> | ||||
<PackageReference Update="Microsoft.Extensions.Hosting" Version="5.0.0" /> | <PackageReference Update="Microsoft.Extensions.Hosting" Version="5.0.0" /> | ||||
<PackageReference Update="Microsoft.Extensions.Options" Version="5.0.0" /> | <PackageReference Update="Microsoft.Extensions.Options" Version="5.0.0" /> | ||||
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.10.0" /> | |||||
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.9.0" /> | |||||
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" /> | <PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" /> | ||||
<PackageReference Update="System.IO.Pipelines" Version="5.0.1" /> | <PackageReference Update="System.IO.Pipelines" Version="5.0.1" /> | ||||
<PackageReference Update="System.Text.Json" Version="5.0.2" /> | <PackageReference Update="System.Text.Json" Version="5.0.2" /> | ||||
@@ -17,6 +17,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Gateway.UnitTes | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Models", "src\Models\Discord.Net.Models.csproj", "{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Discord.Net.Models", "src\Models\Discord.Net.Models.csproj", "{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}" | ||||
EndProject | EndProject | ||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{80F15CCA-4587-49F9-81FE-73FFC3E131BD}" | |||||
EndProject | |||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SourceGenerators", "SourceGenerators", "{811BBF1D-D37B-415A-969F-2BF354F3082E}" | |||||
EndProject | |||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.SourceGenerators.Serialization", "tools\SourceGenerators\Serialization\Discord.Net.SourceGenerators.Serialization.csproj", "{2B1C884B-F8AC-450B-BAA4-210F717DAA42}" | |||||
EndProject | |||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Serialization", "src\Serialization\Discord.Net.Serialization.csproj", "{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}" | |||||
EndProject | |||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
Debug|Any CPU = Debug|Any CPU | Debug|Any CPU = Debug|Any CPU | ||||
@@ -75,6 +83,30 @@ Global | |||||
{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}.Release|x64.Build.0 = Release|Any CPU | {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.ActiveCfg = Release|Any CPU | ||||
{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}.Release|x86.Build.0 = Release|Any CPU | {564A2E82-CE92-42F6-9D4E-8CC09C5CDF17}.Release|x86.Build.0 = Release|Any CPU | ||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Debug|x64.ActiveCfg = Debug|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Debug|x64.Build.0 = Debug|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Debug|x86.ActiveCfg = Debug|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Debug|x86.Build.0 = Debug|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Release|x64.ActiveCfg = Release|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Release|x64.Build.0 = Release|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Release|x86.ActiveCfg = Release|Any CPU | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42}.Release|x86.Build.0 = Release|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Debug|x64.ActiveCfg = Debug|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Debug|x64.Build.0 = Debug|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Debug|x86.ActiveCfg = Debug|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Debug|x86.Build.0 = Debug|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Release|x64.ActiveCfg = Release|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Release|x64.Build.0 = Release|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Release|x86.ActiveCfg = Release|Any CPU | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3}.Release|x86.Build.0 = Release|Any CPU | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
@@ -84,6 +116,9 @@ Global | |||||
{54A6E396-5186-4D79-893B-6EFD1CF658CB} = {6D7B7A29-83FE-44F2-85E1-7D44B061EA27} | {54A6E396-5186-4D79-893B-6EFD1CF658CB} = {6D7B7A29-83FE-44F2-85E1-7D44B061EA27} | ||||
{7EC53EB6-6C15-4FD7-9B83-95F96025C14D} = {A47FC28E-1835-46C3-AFD5-7C048A43C157} | {7EC53EB6-6C15-4FD7-9B83-95F96025C14D} = {A47FC28E-1835-46C3-AFD5-7C048A43C157} | ||||
{564A2E82-CE92-42F6-9D4E-8CC09C5CDF17} = {CD5CFA4B-143E-4495-8BFD-AF419226CBE5} | {564A2E82-CE92-42F6-9D4E-8CC09C5CDF17} = {CD5CFA4B-143E-4495-8BFD-AF419226CBE5} | ||||
{811BBF1D-D37B-415A-969F-2BF354F3082E} = {80F15CCA-4587-49F9-81FE-73FFC3E131BD} | |||||
{2B1C884B-F8AC-450B-BAA4-210F717DAA42} = {811BBF1D-D37B-415A-969F-2BF354F3082E} | |||||
{1288AE15-BFE7-45E4-9769-9D45FE9DD1D3} = {CD5CFA4B-143E-4495-8BFD-AF419226CBE5} | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(ExtensibilityGlobals) = postSolution | GlobalSection(ExtensibilityGlobals) = postSolution | ||||
SolutionGuid = {36B0BFC9-AF79-4D25-89D4-2EE3C961612B} | SolutionGuid = {36B0BFC9-AF79-4D25-89D4-2EE3C961612B} | ||||
@@ -6,7 +6,7 @@ | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="../../src/Gateway/Discord.Net.Gateway.csproj" /> | |||||
<ProjectReference Include="../../src/Models/Discord.Net.Models.csproj" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -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, | |||||
} | |||||
} |
@@ -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; } | |||||
} | |||||
} |
@@ -1,153 +0,0 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Specifies the type of audit log event. | |||||
/// </summary> | |||||
public enum AuditLogEvent : int | |||||
{ | |||||
/// <summary> | |||||
/// Default value of this type. | |||||
/// </summary> | |||||
None = 0, | |||||
/// <summary> | |||||
/// The guild was updated. | |||||
/// </summary> | |||||
GuildUpdate = 1, | |||||
/// <summary> | |||||
/// A channel was created. | |||||
/// </summary> | |||||
ChannelCreate = 10, | |||||
/// <summary> | |||||
/// A channel was updated. | |||||
/// </summary> | |||||
ChannelUpdate = 11, | |||||
/// <summary> | |||||
/// A channel was deleted. | |||||
/// </summary> | |||||
ChannelDelete = 12, | |||||
/// <summary> | |||||
/// A channel overwrite was created. | |||||
/// </summary> | |||||
ChannelOverwriteCreate = 13, | |||||
/// <summary> | |||||
/// A channel overwrite was updated. | |||||
/// </summary> | |||||
ChannelOverwriteUpdate = 14, | |||||
/// <summary> | |||||
/// A channel overwrite was deleted. | |||||
/// </summary> | |||||
ChannelOverwriteDelete = 15, | |||||
/// <summary> | |||||
/// A guild member was kicked. | |||||
/// </summary> | |||||
MemberKick = 20, | |||||
/// <summary> | |||||
/// A guild member was pruned. | |||||
/// </summary> | |||||
MemberPrune = 21, | |||||
/// <summary> | |||||
/// A guild member was banned. | |||||
/// </summary> | |||||
MemberBanAdd = 22, | |||||
/// <summary> | |||||
/// A guild member was unbanned. | |||||
/// </summary> | |||||
MemberBanRemove = 23, | |||||
/// <summary> | |||||
/// A guild member was updated. | |||||
/// </summary> | |||||
MemberUpdate = 24, | |||||
/// <summary> | |||||
/// A guild role was updated. | |||||
/// </summary> | |||||
MemberRoleUpdate = 25, | |||||
/// <summary> | |||||
/// A guild member was moved. | |||||
/// </summary> | |||||
MemberMove = 26, | |||||
/// <summary> | |||||
/// A guild member was disconnected. | |||||
/// </summary> | |||||
MemberDisconnect = 27, | |||||
/// <summary> | |||||
/// A bot was added. | |||||
/// </summary> | |||||
BotAdd = 28, | |||||
/// <summary> | |||||
/// A role was created. | |||||
/// </summary> | |||||
RoleCreate = 30, | |||||
/// <summary> | |||||
/// A role was updated. | |||||
/// </summary> | |||||
RoleUpdate = 31, | |||||
/// <summary> | |||||
/// A role was deleted. | |||||
/// </summary> | |||||
RoleDelete = 32, | |||||
/// <summary> | |||||
/// An invite was created. | |||||
/// </summary> | |||||
InviteCreate = 40, | |||||
/// <summary> | |||||
/// An invite was updated. | |||||
/// </summary> | |||||
InviteUpdate = 41, | |||||
/// <summary> | |||||
/// An invite was deleted. | |||||
/// </summary> | |||||
InviteDelete = 42, | |||||
/// <summary> | |||||
/// A webhook was created. | |||||
/// </summary> | |||||
WebhookCreate = 50, | |||||
/// <summary> | |||||
/// A webhook was updated. | |||||
/// </summary> | |||||
WebhookUpdate = 51, | |||||
/// <summary> | |||||
/// A webhook was deleted. | |||||
/// </summary> | |||||
WebhookDelete = 52, | |||||
/// <summary> | |||||
/// An emoji was created. | |||||
/// </summary> | |||||
EmojiCreate = 60, | |||||
/// <summary> | |||||
/// An emoji was updated. | |||||
/// </summary> | |||||
EmojiUpdate = 61, | |||||
/// <summary> | |||||
/// An emoji was deleted. | |||||
/// </summary> | |||||
EmojiDelete = 62, | |||||
/// <summary> | |||||
/// A message was deleted. | |||||
/// </summary> | |||||
MessageDelete = 72, | |||||
/// <summary> | |||||
/// Message were deleted in bulk. | |||||
/// </summary> | |||||
MessageBulkDelete = 73, | |||||
/// <summary> | |||||
/// A message was pinned. | |||||
/// </summary> | |||||
MessagePin = 74, | |||||
/// <summary> | |||||
/// A message was unpinned. | |||||
/// </summary> | |||||
MessageUnpin = 75, | |||||
/// <summary> | |||||
/// An integration was created. | |||||
/// </summary> | |||||
IntegrationCreate = 80, | |||||
/// <summary> | |||||
/// An integration was updated. | |||||
/// </summary> | |||||
IntegrationUpdate = 81, | |||||
/// <summary> | |||||
/// An integration was deleted. | |||||
/// </summary> | |||||
IntegrationDelete = 82, | |||||
} | |||||
} |
@@ -0,0 +1,241 @@ | |||||
using System; | |||||
using Discord.Net.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a guild or DM channel within Discord. | |||||
/// </summary> | |||||
/// <remarks> | |||||
/// <see href="https://discord.com/developers/docs/resources/channel#channel-object-channel-structure"/> | |||||
/// </remarks> | |||||
/// <param name="Id"> | |||||
/// The id of this channel. | |||||
/// </param> | |||||
/// <param name="Type"> | |||||
/// The type of channel. | |||||
/// </param> | |||||
[DiscriminatedUnion(nameof(Channel.Type))] | |||||
[GenerateSerializer] | |||||
public record Channel( | |||||
ChannelType Type, | |||||
Snowflake Id); | |||||
/// <summary> | |||||
/// Represents a text channel within a server. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildText)] | |||||
[GenerateSerializer] | |||||
public record GuildTextChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
/*Overwrite[] PermissionOverwrites,*/ | |||||
string Name, | |||||
string? Topic, | |||||
bool Nsfw, | |||||
Snowflake LastMessageId, | |||||
int RateLimitPerUser, | |||||
Snowflake? ParentId, | |||||
DateTimeOffset? LastPinTimestamp) | |||||
: Channel( | |||||
ChannelType.GuildText, | |||||
Id); | |||||
/* | |||||
/// <summary> | |||||
/// Represents a direct message between users. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.DM)] | |||||
[GenerateSerializer] | |||||
public record DMChannel( | |||||
Snowflake Id, | |||||
User[] Recipients) | |||||
: Channel( | |||||
ChannelType.DM, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a voice channel within a server. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildVoice)] | |||||
[GenerateSerializer] | |||||
public record GuildVoiceChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, | |||||
string Name, | |||||
bool Nsfw, | |||||
int Bitrate, | |||||
int UserLimit, | |||||
Snowflake? ParentId, | |||||
string? RtcRegion, | |||||
int VideoQualityMode) | |||||
: Channel( | |||||
ChannelType.GuildVoice, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a direct message between multiple users. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GroupDM)] | |||||
[GenerateSerializer] | |||||
public record GroupDMChannel( | |||||
Snowflake Id, | |||||
string Name, | |||||
Snowflake LastMessageId, | |||||
User[] Recipients, | |||||
string? Icon, | |||||
Snowflake? OwnerId, | |||||
Snowflake? ApplicationId, | |||||
DateTimeOffset? LastPinTimestamp) | |||||
: Channel( | |||||
ChannelType.GroupDM, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents an organizational category that contains up to 50 channels. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildCategory)] | |||||
[GenerateSerializer] | |||||
public record GuildCategoryChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, | |||||
string Name) | |||||
: Channel( | |||||
ChannelType.GuildCategory, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a channel that users can follow and crosspost into their own | |||||
/// server. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildNews)] | |||||
[GenerateSerializer] | |||||
public record GuildNewsChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, | |||||
string Name, | |||||
string? Topic, | |||||
bool Nsfw, | |||||
Snowflake? LastMessageId, | |||||
int RateLimitPerUser, | |||||
Snowflake? ParentId, | |||||
Snowflake? LastPinTimestamp) | |||||
: Channel( | |||||
ChannelType.GuildNews, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a channel in which game developers can sell their game on | |||||
/// Discord. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildStore)] | |||||
[GenerateSerializer] | |||||
public record GuildStoreChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, // I guess??? | |||||
string? Name, | |||||
Snowflake? ParentId) | |||||
: Channel( | |||||
ChannelType.GuildStore, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a temporary sub-channel within a | |||||
/// <see cref="GuildNewsChannel"/>. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildNewsThread)] | |||||
[GenerateSerializer] | |||||
public record GuildNewsThreadChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, // I guess?? | |||||
string Name, | |||||
Snowflake? LastMessageId, | |||||
Snowflake? ParentId, | |||||
Snowflake? LastPinTimestamp, | |||||
int MessageCount, | |||||
int MemberCount, | |||||
ThreadMetadata ThreadMetadata, | |||||
ThreadMember Member) | |||||
: Channel( | |||||
ChannelType.GuildNewsThread, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a temporary sub-channel within a | |||||
/// <see cref="GuildTextChannel"/>. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildPublicThread)] | |||||
[GenerateSerializer] | |||||
public record GuildPublicThreadChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, // I guess?? | |||||
string Name, | |||||
Snowflake? LastMessageId, | |||||
Snowflake? ParentId, | |||||
Snowflake? LastPinTimestamp, | |||||
int MessageCount, | |||||
int MemberCount, | |||||
ThreadMetadata ThreadMetadata, | |||||
ThreadMember Member) | |||||
: Channel( | |||||
ChannelType.GuildPublicThread, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a temporary sub-channel within a | |||||
/// <see cref="GuildTextChannel"/> that is only viewable by those invited | |||||
/// and those with the MANAGE_THREADS permission. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildPrivateThread)] | |||||
[GenerateSerializer] | |||||
public record GuildPrivateThreadChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, // I guess??? | |||||
string Name, | |||||
Snowflake? LastMessageId, | |||||
Snowflake? ParentId, | |||||
Snowflake? LastPinTimestamp, | |||||
int MessageCount, | |||||
int MemberCount, | |||||
ThreadMetadata ThreadMetadata, | |||||
ThreadMember Member) | |||||
: Channel( | |||||
ChannelType.GuildPrivateThread, | |||||
Id); | |||||
/// <summary> | |||||
/// Represents a voice channel for hosting events with an audience. | |||||
/// </summary> | |||||
[DiscriminatedUnionMember(ChannelType.GuildStageVoice)] | |||||
[GenerateSerializer] | |||||
public record GuildStageVoiceChannel( | |||||
Snowflake Id, | |||||
Snowflake GuildId, | |||||
int Position, | |||||
Overwrite[] PermissionOverwrites, | |||||
string Name, | |||||
int Bitrate, | |||||
int UserLimit, | |||||
string? RtcRegion) | |||||
: Channel( | |||||
ChannelType.GuildStageVoice, | |||||
Id); | |||||
*/ | |||||
} |
@@ -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,38 +0,0 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the type of embed. | |||||
/// </summary> | |||||
public enum EmbedType | |||||
{ | |||||
/// <summary> | |||||
/// Generic embed rendered from embed attributes. | |||||
/// </summary> | |||||
Rich, | |||||
/// <summary> | |||||
/// Image embed. | |||||
/// </summary> | |||||
Image, | |||||
/// <summary> | |||||
/// Video embed. | |||||
/// </summary> | |||||
Video, | |||||
/// <summary> | |||||
/// Animated gif image embed rendered as a video embed. | |||||
/// </summary> | |||||
Gifv, | |||||
/// <summary> | |||||
/// Article embed. | |||||
/// </summary> | |||||
Article, | |||||
/// <summary> | |||||
/// Link embed. | |||||
/// </summary> | |||||
Link, | |||||
} | |||||
} |
@@ -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,121 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the message type. | |||||
/// </summary> | |||||
[Flags] | |||||
public enum MessageType | |||||
{ | |||||
/// <summary> | |||||
/// Default message type. | |||||
/// </summary> | |||||
Default = 0, | |||||
/// <summary> | |||||
/// Recipient was added. | |||||
/// </summary> | |||||
RecipientAdd = 1, | |||||
/// <summary> | |||||
/// Recipient was removed. | |||||
/// </summary> | |||||
RecipientRemove = 2, | |||||
/// <summary> | |||||
/// Request to join a call. | |||||
/// </summary> | |||||
Call = 3, | |||||
/// <summary> | |||||
/// Channel name was changed. | |||||
/// </summary> | |||||
ChannelNameChange = 4, | |||||
/// <summary> | |||||
/// Channel icon was changed. | |||||
/// </summary> | |||||
ChannelIconChange = 5, | |||||
/// <summary> | |||||
/// Message was pinned in this channel. | |||||
/// </summary> | |||||
ChannelPinnedMessage = 6, | |||||
/// <summary> | |||||
/// User joined the guild. | |||||
/// </summary> | |||||
GuildMemberJoin = 7, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
UserPremiumGuildSubscription = 8, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
UserPremiumGuildSubscriptionTier1 = 9, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
UserPremiumGuildSubscriptionTier2 = 10, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
UserPremiumGuildSubscriptionTier3 = 11, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
ChannelFollowAdd = 12, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
GuildDiscoveryDisqualified = 14, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
GuildDiscoveryRequalified = 15, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
GuildDiscoveryGracePeriodInitialWarning = 16, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
GuildDiscoveryGracePeriodFinalWarning = 17, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
ThreadCreated = 18, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
Reply = 19, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
ApplicationCommand = 20, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
ThreadStarterMessage = 21, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
GuildInviteReminder = 22, | |||||
} | |||||
} |
@@ -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,68 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Declares an enum which represents the type of 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 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 <see cref="GuildNews"/> channel. | |||||
/// </summary> | |||||
GuildNewsThread = 10, | |||||
/// <summary> | |||||
/// A temporary sub-channel within a <see cref="GuildText"/> channel. | |||||
/// </summary> | |||||
GuildPublicThread = 11, | |||||
/// <summary> | |||||
/// A temporary sub-channel within a <see cref="GuildText"/> 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 | |||||
} | |||||
} |
@@ -7,10 +7,21 @@ | |||||
$(Description) | $(Description) | ||||
Shared models between the Discord REST API and Gateway. | Shared models between the Discord REST API and Gateway. | ||||
</Description> | </Description> | ||||
<DiscordNet_SerializationGenerator_OptionsTypeNamespace>Discord.Net.Serialization</DiscordNet_SerializationGenerator_OptionsTypeNamespace> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="System.Text.Json" /> | <PackageReference Include="System.Text.Json" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | |||||
<CompilerVisibleProperty Include="DiscordNet_SerializationGenerator_OptionsTypeNamespace" /> | |||||
<ProjectReference Include="../../tools/SourceGenerators/Serialization/Discord.Net.SourceGenerators.Serialization.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /> | |||||
</ItemGroup> | |||||
<ItemGroup> | |||||
<ProjectReference Include="../Serialization/Discord.Net.Serialization.csproj" /> | |||||
</ItemGroup> | |||||
</Project> | </Project> |
@@ -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,41 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the activity flags. | |||||
/// </summary> | |||||
[Flags] | |||||
public enum ActivityFlags | |||||
{ | |||||
/// <summary> | |||||
/// Activity instance. | |||||
/// </summary> | |||||
Instance = 1 << 0, | |||||
/// <summary> | |||||
/// Activity join. | |||||
/// </summary> | |||||
Join = 1 << 1, | |||||
/// <summary> | |||||
/// Activity spectate. | |||||
/// </summary> | |||||
Spectate = 1 << 2, | |||||
/// <summary> | |||||
/// Activity join request. | |||||
/// </summary> | |||||
JoinRequest = 1 << 3, | |||||
/// <summary> | |||||
/// Activity sync. | |||||
/// </summary> | |||||
Sync = 1 << 4, | |||||
/// <summary> | |||||
/// Activity play. | |||||
/// </summary> | |||||
Play = 1 << 5, | |||||
} | |||||
} |
@@ -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,38 +0,0 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the activity type. | |||||
/// </summary> | |||||
public enum ActivityType | |||||
{ | |||||
/// <summary> | |||||
/// Playing {name}. | |||||
/// </summary> | |||||
Game = 0, | |||||
/// <summary> | |||||
/// Streaming {details}. | |||||
/// </summary> | |||||
Streaming = 1, | |||||
/// <summary> | |||||
/// Listening to {name}. | |||||
/// </summary> | |||||
Listening = 2, | |||||
/// <summary> | |||||
/// Watching {name}. | |||||
/// </summary> | |||||
Watching = 3, | |||||
/// <summary> | |||||
/// {emoji} {name}. | |||||
/// </summary> | |||||
Custom = 4, | |||||
/// <summary> | |||||
/// Competing in {name}. | |||||
/// </summary> | |||||
Competing = 5, | |||||
} | |||||
} |
@@ -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,30 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the guild NSFW level. | |||||
/// </summary> | |||||
public enum GuildNsfwLevel | |||||
{ | |||||
/// <summary> | |||||
/// Default level. | |||||
/// </summary> | |||||
Default = 0, | |||||
/// <summary> | |||||
/// Guild contains explicit content. | |||||
/// </summary> | |||||
Explicit = 1, | |||||
/// <summary> | |||||
/// Guild is safe for work. | |||||
/// </summary> | |||||
Safe = 2, | |||||
/// <summary> | |||||
/// Guild has an age restriction. | |||||
/// </summary> | |||||
AgeRestricted = 3, | |||||
} | |||||
} |
@@ -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,26 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the system channel flags. | |||||
/// </summary> | |||||
[Flags] | |||||
public enum SystemChannelFlags | |||||
{ | |||||
/// <summary> | |||||
/// Suppress member join notifications. | |||||
/// </summary> | |||||
SuppressJoinNotifications = 1 << 0, | |||||
/// <summary> | |||||
/// Suppress server boost notifications. | |||||
/// </summary> | |||||
SuppressPremiumSubscriptions = 1 << 1, | |||||
/// <summary> | |||||
/// Suppress server setup tips. | |||||
/// </summary> | |||||
SuppressGuildReminderNotifications = 1 << 2, | |||||
} | |||||
} |
@@ -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; } | |||||
} | |||||
} |
@@ -1,99 +0,0 @@ | |||||
using System; | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a invite object. | |||||
/// </summary> | |||||
public record Invite | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="Invite"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="code">The invite code (unique ID).</param> | |||||
/// <param name="guild">The guild this invite is for.</param> | |||||
/// <param name="channel">The channel this invite is for.</param> | |||||
/// <param name="inviter">The user who created the invite.</param> | |||||
/// <param name="targetType">The type of target for this voice channel invite.</param> | |||||
/// <param name="targetUser">The user whose stream to display for this voice channel stream invite.</param> | |||||
/// <param name="targetApplication">The embedded application to open for this voice channel embedded application invite.</param> | |||||
/// <param name="approximatePresenceCount">Approximate count of online members.</param> | |||||
/// <param name="approximateMemberCount">Approximate count of total members.</param> | |||||
/// <param name="expiresAt">The expiration date of this invite.</param> | |||||
[JsonConstructor] | |||||
public Invite(string code, Optional<Guild> guild, Channel channel, Optional<User> inviter, Optional<InviteTargetType> targetType, Optional<User> targetUser, Optional<Application> targetApplication, Optional<int> approximatePresenceCount, Optional<int> approximateMemberCount, Optional<DateTimeOffset?> expiresAt) | |||||
{ | |||||
Code = code; | |||||
Guild = guild; | |||||
Channel = channel; | |||||
Inviter = inviter; | |||||
TargetType = targetType; | |||||
TargetUser = targetUser; | |||||
TargetApplication = targetApplication; | |||||
ApproximatePresenceCount = approximatePresenceCount; | |||||
ApproximateMemberCount = approximateMemberCount; | |||||
ExpiresAt = expiresAt; | |||||
} | |||||
/// <summary> | |||||
/// The invite code (unique ID). | |||||
/// </summary> | |||||
[JsonPropertyName("code")] | |||||
public string Code { get; } | |||||
/// <summary> | |||||
/// The guild this invite is for. | |||||
/// </summary> | |||||
[JsonPropertyName("guild")] | |||||
public Optional<Guild> Guild { get; } | |||||
/// <summary> | |||||
/// The channel this invite is for. | |||||
/// </summary> | |||||
[JsonPropertyName("channel")] | |||||
public Channel Channel { get; } | |||||
/// <summary> | |||||
/// The user who created the invite. | |||||
/// </summary> | |||||
[JsonPropertyName("inviter")] | |||||
public Optional<User> Inviter { get; } | |||||
/// <summary> | |||||
/// The type of target for this voice channel invite. | |||||
/// </summary> | |||||
[JsonPropertyName("target_type")] | |||||
public Optional<InviteTargetType> TargetType { get; } | |||||
/// <summary> | |||||
/// The user whose stream to display for this voice channel stream invite. | |||||
/// </summary> | |||||
[JsonPropertyName("target_user")] | |||||
public Optional<User> TargetUser { get; } | |||||
/// <summary> | |||||
/// The embedded application to open for this voice channel embedded application invite. | |||||
/// </summary> | |||||
[JsonPropertyName("target_application")] | |||||
public Optional<Application> TargetApplication { get; } | |||||
/// <summary> | |||||
/// Approximate count of online members. | |||||
/// </summary> | |||||
[JsonPropertyName("approximate_presence_count")] | |||||
public Optional<int> ApproximatePresenceCount { get; } | |||||
/// <summary> | |||||
/// Approximate count of total members. | |||||
/// </summary> | |||||
[JsonPropertyName("approximate_member_count")] | |||||
public Optional<int> ApproximateMemberCount { get; } | |||||
/// <summary> | |||||
/// The expiration date of this invite. | |||||
/// </summary> | |||||
[JsonPropertyName("expires_at")] | |||||
public Optional<DateTimeOffset?> ExpiresAt { get; } | |||||
} | |||||
} |
@@ -1,70 +0,0 @@ | |||||
using System; | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a invite metadata object. | |||||
/// </summary> | |||||
public record InviteMetadata : Invite | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="InviteMetadata"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="code">The invite code (unique ID).</param> | |||||
/// <param name="guild">The guild this invite is for.</param> | |||||
/// <param name="channel">The channel this invite is for.</param> | |||||
/// <param name="inviter">The user who created the invite.</param> | |||||
/// <param name="targetType">The type of target for this voice channel invite.</param> | |||||
/// <param name="targetUser">The user whose stream to display for this voice channel stream invite.</param> | |||||
/// <param name="targetApplication">The embedded application to open for this voice channel embedded application invite.</param> | |||||
/// <param name="approximatePresenceCount">Approximate count of online members.</param> | |||||
/// <param name="approximateMemberCount">Approximate count of total members.</param> | |||||
/// <param name="expiresAt">The expiration date of this invite.</param> | |||||
/// <param name="uses">Number of times this invite has been used.</param> | |||||
/// <param name="maxUses">Max number of times this invite can be used.</param> | |||||
/// <param name="maxAge">Duration (in seconds) after which the invite expires.</param> | |||||
/// <param name="temporary">Whether this invite only grants temporary membership.</param> | |||||
/// <param name="createdAt">When this invite was created.</param> | |||||
[JsonConstructor] | |||||
public InviteMetadata(string code, Optional<Guild> guild, Channel channel, Optional<User> inviter, Optional<InviteTargetType> targetType, Optional<User> targetUser, Optional<Application> targetApplication, Optional<int> approximatePresenceCount, Optional<int> approximateMemberCount, Optional<DateTimeOffset?> expiresAt, int uses, int maxUses, int maxAge, bool temporary, DateTimeOffset createdAt) | |||||
: base(code, guild, channel, inviter, targetType, targetUser, targetApplication, approximatePresenceCount, approximateMemberCount, expiresAt) | |||||
{ | |||||
Uses = uses; | |||||
MaxUses = maxUses; | |||||
MaxAge = maxAge; | |||||
Temporary = temporary; | |||||
CreatedAt = createdAt; | |||||
} | |||||
/// <summary> | |||||
/// Number of times this invite has been used. | |||||
/// </summary> | |||||
[JsonPropertyName("uses")] | |||||
public int Uses { get; } | |||||
/// <summary> | |||||
/// Max number of times this invite can be used. | |||||
/// </summary> | |||||
[JsonPropertyName("max_uses")] | |||||
public int MaxUses { get; } | |||||
/// <summary> | |||||
/// Duration (in seconds) after which the invite expires. | |||||
/// </summary> | |||||
[JsonPropertyName("max_age")] | |||||
public int MaxAge { get; } | |||||
/// <summary> | |||||
/// Whether this invite only grants temporary membership. | |||||
/// </summary> | |||||
[JsonPropertyName("temporary")] | |||||
public bool Temporary { get; } | |||||
/// <summary> | |||||
/// When this invite was created. | |||||
/// </summary> | |||||
[JsonPropertyName("created_at")] | |||||
public DateTimeOffset CreatedAt { get; } | |||||
} | |||||
} |
@@ -1,20 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the invite target type. | |||||
/// </summary> | |||||
public enum InviteTargetType | |||||
{ | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
Stream = 1, | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
EmbeddedApplication = 2, | |||||
} | |||||
} |
@@ -1,26 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a component object. | |||||
/// </summary> | |||||
public record ActionRowComponent : Component | |||||
{ | |||||
/// <summary> | |||||
/// Creates an <see cref="ActionRowComponent"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="type">Component type.</param> | |||||
[JsonConstructor] | |||||
public ActionRowComponent(ComponentType type) | |||||
: base(type) | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// Components inside this action row, like buttons or other interactive components. | |||||
/// </summary> | |||||
[JsonPropertyName("components")] | |||||
public Optional<Component[]> Components { get; } | |||||
} | |||||
} |
@@ -1,68 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a button component object. | |||||
/// </summary> | |||||
public record ButtonComponent : Component | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="ButtonComponent"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="type">Component type.</param> | |||||
/// <param name="style">One of button styles.</param> | |||||
/// <param name="label">Text that appears on the button, max 80 characters.</param> | |||||
/// <param name="emoji">Name, id, and animated.</param> | |||||
/// <param name="customId">A developer-defined identifier for the button, max 100 characters.</param> | |||||
/// <param name="url">A url for link-style buttons.</param> | |||||
/// <param name="disabled">Whether the button is disabled, default false.</param> | |||||
[JsonConstructor] | |||||
public ButtonComponent(ComponentType type, Optional<ButtonStyle> style, Optional<string> label, Optional<Emoji> emoji, Optional<string> customId, Optional<string> url, Optional<bool> disabled) | |||||
: base(type) | |||||
{ | |||||
Style = style; | |||||
Label = label; | |||||
Emoji = emoji; | |||||
CustomId = customId; | |||||
Url = url; | |||||
Disabled = disabled; | |||||
} | |||||
/// <summary> | |||||
/// One of button styles. | |||||
/// </summary> | |||||
[JsonPropertyName("style")] | |||||
public Optional<ButtonStyle> Style { get; } | |||||
/// <summary> | |||||
/// Text that appears on the button, max 80 characters. | |||||
/// </summary> | |||||
[JsonPropertyName("label")] | |||||
public Optional<string> Label { get; } | |||||
/// <summary> | |||||
/// Name, id, and animated. | |||||
/// </summary> | |||||
[JsonPropertyName("emoji")] | |||||
public Optional<Emoji> Emoji { get; } | |||||
/// <summary> | |||||
/// A developer-defined identifier for the button, max 100 characters. | |||||
/// </summary> | |||||
[JsonPropertyName("custom_id")] | |||||
public Optional<string> CustomId { get; } | |||||
/// <summary> | |||||
/// A url for link-style buttons. | |||||
/// </summary> | |||||
[JsonPropertyName("url")] | |||||
public Optional<string> Url { get; } | |||||
/// <summary> | |||||
/// Whether the button is disabled, default false. | |||||
/// </summary> | |||||
[JsonPropertyName("disabled")] | |||||
public Optional<bool> Disabled { get; } | |||||
} | |||||
} |
@@ -1,33 +0,0 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the button style type. | |||||
/// </summary> | |||||
public enum ButtonStyle | |||||
{ | |||||
/// <summary> | |||||
/// Blurple. | |||||
/// </summary> | |||||
Primary = 1, | |||||
/// <summary> | |||||
/// Grey. | |||||
/// </summary> | |||||
Secondary = 2, | |||||
/// <summary> | |||||
/// Green. | |||||
/// </summary> | |||||
Success = 3, | |||||
/// <summary> | |||||
/// Red. | |||||
/// </summary> | |||||
Danger = 4, | |||||
/// <summary> | |||||
/// Grey, navigates to a URL. | |||||
/// </summary> | |||||
Link = 5, | |||||
} | |||||
} |
@@ -1,26 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a component object. | |||||
/// </summary> | |||||
public record Component | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="Component"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="type">Component type.</param> | |||||
[JsonConstructor] | |||||
public Component(ComponentType type) | |||||
{ | |||||
Type = type; | |||||
} | |||||
/// <summary> | |||||
/// Component type. | |||||
/// </summary> | |||||
[JsonPropertyName("type")] | |||||
public ComponentType Type { get; } | |||||
} | |||||
} |
@@ -1,20 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the component type. | |||||
/// </summary> | |||||
public enum ComponentType | |||||
{ | |||||
/// <summary> | |||||
/// A container for other components. | |||||
/// </summary> | |||||
ActionRow = 1, | |||||
/// <summary> | |||||
/// A clickable button. | |||||
/// </summary> | |||||
Button = 2, | |||||
} | |||||
} |
@@ -1,98 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net | |||||
{ | |||||
/// <summary> | |||||
/// Container to keep a type that might not be present. | |||||
/// </summary> | |||||
/// <typeparam name="T">Inner type</typeparam> | |||||
public struct Optional<T> | |||||
{ | |||||
private readonly T _value; | |||||
/// <summary> | |||||
/// Gets the inner value of this <see cref="Optional{T}"/> if present. | |||||
/// </summary> | |||||
/// <returns>The value inside this <see cref="Optional{T}"/>.</returns> | |||||
/// <exception cref="InvalidOperationException">This <see cref="Optional{T}"/> has no inner value.</exception> | |||||
public T Value => !IsSpecified ? throw new InvalidOperationException("This property has no value set.") : _value; | |||||
/// <summary> | |||||
/// Gets if this <see cref="Optional{T}"/> has an inner value. | |||||
/// </summary> | |||||
/// <returns>A boolean that determines if this <see cref="Optional{T}"/> has a <see cref="Value"/>.</returns> | |||||
public bool IsSpecified { get; } | |||||
private Optional(T value) | |||||
{ | |||||
_value = value; | |||||
IsSpecified = true; | |||||
} | |||||
/// <summary> | |||||
/// Creates a new unspecified <see cref="Optional{T}"/>. | |||||
/// </summary> | |||||
/// <returns>An unspecified <see cref="Optional{T}"/>.</returns> | |||||
public static Optional<T> Create() | |||||
=> default; | |||||
/// <summary> | |||||
/// Creates a new <see cref="Optional{T}"/> with the specified <paramref name="value"/>. | |||||
/// </summary> | |||||
/// <param name="value">Value that will be specified for this <see cref="Optional{T}"/>.</param> | |||||
/// <returns>A specified <see cref="Optional{T}"/> with the provided value inside.</returns> | |||||
public static Optional<T> Create(T value) | |||||
=> new(value); | |||||
/// <summary> | |||||
/// Gets the <see cref="Value"/> or their <see langword="default"/> value. | |||||
/// </summary> | |||||
/// <returns>The value inside this <see cref="Optional{T}"/> or their <see langword="default"/> value.</returns> | |||||
public T GetValueOrDefault() | |||||
=> _value; | |||||
/// <summary> | |||||
/// Gets the <see cref="Value"/> or the default value provided. | |||||
/// </summary> | |||||
/// <returns>The value inside this <see cref="Optional{T}"/> or default value provided.</returns> | |||||
public T GetValueOrDefault(T defaultValue) | |||||
=> IsSpecified ? _value : defaultValue; | |||||
/// <inheritdoc/> | |||||
public override bool Equals(object? other) | |||||
{ | |||||
if (!IsSpecified) | |||||
return other == null; | |||||
if (other == null || _value == null) | |||||
return false; | |||||
return _value.Equals(other); | |||||
} | |||||
/// <inheritdoc/> | |||||
public override int GetHashCode() | |||||
=> IsSpecified ? _value?.GetHashCode() ?? default : default; | |||||
/// <summary> | |||||
/// Returns the inner value ToString value or this type fully qualified name. | |||||
/// </summary> | |||||
/// <returns>The inner value string value or this type fully qualified name.</returns> | |||||
public override string? ToString() | |||||
=> IsSpecified ? _value?.ToString() : default; | |||||
/// <summary> | |||||
/// Creates a new <see cref="Optional{T}"/> with the specified <paramref name="value"/>. | |||||
/// </summary> | |||||
/// <param name="value">Value to convert</param> | |||||
/// <returns>A new <see cref="Optional{T}"/> with the specified <paramref name="value"/></returns> | |||||
public static implicit operator Optional<T>(T value) | |||||
=> new(value); | |||||
/// <summary> | |||||
/// Gets the inner value. | |||||
/// </summary> | |||||
/// <param name="value">Value to convert</param> | |||||
/// <returns>The inner value</returns> | |||||
public static explicit operator T(Optional<T> value) | |||||
=> value.Value; | |||||
} | |||||
} |
@@ -1,191 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the permissions flags. | |||||
/// </summary> | |||||
[Flags] | |||||
public enum Permissions | |||||
{ | |||||
/// <summary> | |||||
/// Allows creation of instant invites. | |||||
/// </summary> | |||||
CreateInstantInvite = 1 << 0, | |||||
/// <summary> | |||||
/// Allows kicking members. | |||||
/// </summary> | |||||
KickMembers = 1 << 1, | |||||
/// <summary> | |||||
/// Allows banning members. | |||||
/// </summary> | |||||
BanMembers = 1 << 2, | |||||
/// <summary> | |||||
/// Allows all permissions and bypasses channel permission overwrites. | |||||
/// </summary> | |||||
Administrator = 1 << 3, | |||||
/// <summary> | |||||
/// Allows management and editing of channels. | |||||
/// </summary> | |||||
ManageChannels = 1 << 4, | |||||
/// <summary> | |||||
/// Allows management and editing of the guild. | |||||
/// </summary> | |||||
ManageGuild = 1 << 5, | |||||
/// <summary> | |||||
/// Allows for the addition of reactions to messages. | |||||
/// </summary> | |||||
AddReactions = 1 << 6, | |||||
/// <summary> | |||||
/// Allows for viewing of audit logs. | |||||
/// </summary> | |||||
ViewAuditLog = 1 << 7, | |||||
/// <summary> | |||||
/// Allows for using priority speaker in a voice channel. | |||||
/// </summary> | |||||
PrioritySpeaker = 1 << 8, | |||||
/// <summary> | |||||
/// Allows the user to go live. | |||||
/// </summary> | |||||
Stream = 1 << 9, | |||||
/// <summary> | |||||
/// Allows guild members to view a channel, which includes reading messages in text channels. | |||||
/// </summary> | |||||
ViewChannel = 1 << 10, | |||||
/// <summary> | |||||
/// Allows for sending messages in a channel. | |||||
/// </summary> | |||||
SendMessages = 1 << 11, | |||||
/// <summary> | |||||
/// Allows for sending of /tts messages. | |||||
/// </summary> | |||||
SendTtsMessages = 1 << 12, | |||||
/// <summary> | |||||
/// Allows for deletion of other users messages. | |||||
/// </summary> | |||||
ManageMessages = 1 << 13, | |||||
/// <summary> | |||||
/// Links sent by users with this permission will be auto-embedded. | |||||
/// </summary> | |||||
EmbedLinks = 1 << 14, | |||||
/// <summary> | |||||
/// Allows for uploading images and files. | |||||
/// </summary> | |||||
AttachFiles = 1 << 15, | |||||
/// <summary> | |||||
/// Allows for reading of message history. | |||||
/// </summary> | |||||
ReadMessageHistory = 1 << 16, | |||||
/// <summary> | |||||
/// Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel. | |||||
/// </summary> | |||||
MentionEveryone = 1 << 17, | |||||
/// <summary> | |||||
/// Allows the usage of custom emojis from other servers. | |||||
/// </summary> | |||||
UseExternalEmojis = 1 << 18, | |||||
/// <summary> | |||||
/// Allows for viewing guild insights. | |||||
/// </summary> | |||||
ViewGuildInsights = 1 << 19, | |||||
/// <summary> | |||||
/// Allows for joining of a voice channel. | |||||
/// </summary> | |||||
Connect = 1 << 20, | |||||
/// <summary> | |||||
/// Allows for speaking in a voice channel. | |||||
/// </summary> | |||||
Speak = 1 << 21, | |||||
/// <summary> | |||||
/// Allows for muting members in a voice channel. | |||||
/// </summary> | |||||
MuteMembers = 1 << 22, | |||||
/// <summary> | |||||
/// Allows for deafening of members in a voice channel. | |||||
/// </summary> | |||||
DeafenMembers = 1 << 23, | |||||
/// <summary> | |||||
/// Allows for moving of members between voice channels. | |||||
/// </summary> | |||||
MoveMembers = 1 << 24, | |||||
/// <summary> | |||||
/// Allows for using voice-activity-detection in a voice channel. | |||||
/// </summary> | |||||
UseVad = 1 << 25, | |||||
/// <summary> | |||||
/// Allows for modification of own nickname. | |||||
/// </summary> | |||||
ChangeNickname = 1 << 26, | |||||
/// <summary> | |||||
/// Allows for modification of other users nicknames. | |||||
/// </summary> | |||||
ManageNicknames = 1 << 27, | |||||
/// <summary> | |||||
/// Allows management and editing of roles. | |||||
/// </summary> | |||||
ManageRoles = 1 << 28, | |||||
/// <summary> | |||||
/// Allows management and editing of webhooks. | |||||
/// </summary> | |||||
ManageWebhooks = 1 << 29, | |||||
/// <summary> | |||||
/// Allows management and editing of emojis. | |||||
/// </summary> | |||||
ManageEmojis = 1 << 30, | |||||
/// <summary> | |||||
/// Allows members to use slash commands in text channels. | |||||
/// </summary> | |||||
UseSlashCommands = 1 << 31, | |||||
/// <summary> | |||||
/// Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.). | |||||
/// </summary> | |||||
RequestToSpeak = 1 << 32, | |||||
/// <summary> | |||||
/// Allows for deleting and archiving threads, and viewing all private threads. | |||||
/// </summary> | |||||
ManageThreads = 1 << 34, | |||||
/// <summary> | |||||
/// Allows for creating and participating in threads. | |||||
/// </summary> | |||||
UsePublicThreads = 1 << 35, | |||||
/// <summary> | |||||
/// Allows for creating and participating in private threads. | |||||
/// </summary> | |||||
UsePrivateThreads = 1 << 36, | |||||
} | |||||
} |
@@ -1,90 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a role object. | |||||
/// </summary> | |||||
public record Role | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="Role"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="id">Role id.</param> | |||||
/// <param name="name">Role name.</param> | |||||
/// <param name="color">Integer representation of hexadecimal color code.</param> | |||||
/// <param name="hoist">If this role is pinned in the user listing.</param> | |||||
/// <param name="position">Position of this role.</param> | |||||
/// <param name="permissions">Permission bit set.</param> | |||||
/// <param name="managed">Whether this role is managed by an integration.</param> | |||||
/// <param name="mentionable">Whether this role is mentionable.</param> | |||||
/// <param name="tags">The tags this role has.</param> | |||||
[JsonConstructor] | |||||
public Role(Snowflake id, string name, int color, bool hoist, int position, Permissions permissions, bool managed, bool mentionable, Optional<RoleTags> tags) | |||||
{ | |||||
Id = id; | |||||
Name = name; | |||||
Color = color; | |||||
Hoist = hoist; | |||||
Position = position; | |||||
Permissions = permissions; | |||||
Managed = managed; | |||||
Mentionable = mentionable; | |||||
Tags = tags; | |||||
} | |||||
/// <summary> | |||||
/// Role id. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public Snowflake Id { get; } | |||||
/// <summary> | |||||
/// Role name. | |||||
/// </summary> | |||||
[JsonPropertyName("name")] | |||||
public string Name { get; } | |||||
/// <summary> | |||||
/// Integer representation of hexadecimal color code. | |||||
/// </summary> | |||||
[JsonPropertyName("color")] | |||||
public int Color { get; } | |||||
/// <summary> | |||||
/// If this role is pinned in the user listing. | |||||
/// </summary> | |||||
[JsonPropertyName("hoist")] | |||||
public bool Hoist { get; } | |||||
/// <summary> | |||||
/// Position of this role. | |||||
/// </summary> | |||||
[JsonPropertyName("position")] | |||||
public int Position { get; } | |||||
/// <summary> | |||||
/// Permission bit set. | |||||
/// </summary> | |||||
[JsonPropertyName("permissions")] | |||||
public Permissions Permissions { get; } | |||||
/// <summary> | |||||
/// Whether this role is managed by an integration. | |||||
/// </summary> | |||||
[JsonPropertyName("managed")] | |||||
public bool Managed { get; } | |||||
/// <summary> | |||||
/// Whether this role is mentionable. | |||||
/// </summary> | |||||
[JsonPropertyName("mentionable")] | |||||
public bool Mentionable { get; } | |||||
/// <summary> | |||||
/// The tags this role has. | |||||
/// </summary> | |||||
[JsonPropertyName("tags")] | |||||
public Optional<RoleTags> Tags { get; } | |||||
} | |||||
} |
@@ -1,42 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a role tags object. | |||||
/// </summary> | |||||
public record RoleTags | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="RoleTags"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="botId">The id of the bot this role belongs to.</param> | |||||
/// <param name="integrationId">The id of the integration this role belongs to.</param> | |||||
/// <param name="premiumSubscriber">Whether this is the guild's premium subscriber role.</param> | |||||
[JsonConstructor] | |||||
public RoleTags(Optional<Snowflake> botId, Optional<Snowflake> integrationId, Optional<bool?> premiumSubscriber) | |||||
{ | |||||
BotId = botId; | |||||
IntegrationId = integrationId; | |||||
PremiumSubscriber = premiumSubscriber; | |||||
} | |||||
/// <summary> | |||||
/// The id of the bot this role belongs to. | |||||
/// </summary> | |||||
[JsonPropertyName("bot_id")] | |||||
public Optional<Snowflake> BotId { get; } | |||||
/// <summary> | |||||
/// The id of the integration this role belongs to. | |||||
/// </summary> | |||||
[JsonPropertyName("integration_id")] | |||||
public Optional<Snowflake> IntegrationId { get; } | |||||
/// <summary> | |||||
/// Whether this is the guild's premium subscriber role. | |||||
/// </summary> | |||||
[JsonPropertyName("premium_subscriber")] | |||||
public Optional<bool?> PremiumSubscriber { get; } | |||||
} | |||||
} |
@@ -1,23 +0,0 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the interaction type. | |||||
/// </summary> | |||||
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 component. | |||||
/// </summary> | |||||
MessageComponent = 3, | |||||
} | |||||
} |
@@ -1,50 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a message interaction object. | |||||
/// </summary> | |||||
public record MessageInteraction | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="MessageInteraction"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="id">Id of the interaction.</param> | |||||
/// <param name="type">The type of interaction.</param> | |||||
/// <param name="name">The name of the ApplicationCommand.</param> | |||||
/// <param name="user">The user who invoked the interaction.</param> | |||||
[JsonConstructor] | |||||
public MessageInteraction(Snowflake id, InteractionType type, string name, User user) | |||||
{ | |||||
Id = id; | |||||
Type = type; | |||||
Name = name; | |||||
User = user; | |||||
} | |||||
/// <summary> | |||||
/// Id of the interaction. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public Snowflake Id { get; } | |||||
/// <summary> | |||||
/// The type of interaction. | |||||
/// </summary> | |||||
[JsonPropertyName("type")] | |||||
public InteractionType Type { get; } | |||||
/// <summary> | |||||
/// The name of the ApplicationCommand. | |||||
/// </summary> | |||||
[JsonPropertyName("name")] | |||||
public string Name { get; } | |||||
/// <summary> | |||||
/// The user who invoked the interaction. | |||||
/// </summary> | |||||
[JsonPropertyName("user")] | |||||
public User User { get; } | |||||
} | |||||
} |
@@ -1,20 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the privacy level. | |||||
/// </summary> | |||||
public enum PrivacyLevel | |||||
{ | |||||
/// <summary> | |||||
/// The Stage instance is visible publicly, such as on Stage discovery. | |||||
/// </summary> | |||||
Public = 1, | |||||
/// <summary> | |||||
/// The Stage instance is visible to only guild members. | |||||
/// </summary> | |||||
GuildOnly = 2, | |||||
} | |||||
} |
@@ -1,66 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a stage instance object. | |||||
/// </summary> | |||||
public record StageInstance | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="StageInstance"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="id">The id of this Stage instance.</param> | |||||
/// <param name="guildId">The guild id of the associated Stage channel.</param> | |||||
/// <param name="channelId">The id of the associated Stage channel.</param> | |||||
/// <param name="topic">The topic of the Stage instance (1-120 characters).</param> | |||||
/// <param name="privacyLevel">The privacy level of the Stage instance.</param> | |||||
/// <param name="discoverableDisabled">Whether or not Stage discovery is disabled.</param> | |||||
[JsonConstructor] | |||||
public StageInstance(Snowflake id, Snowflake guildId, Snowflake channelId, string topic, PrivacyLevel privacyLevel, bool discoverableDisabled) | |||||
{ | |||||
Id = id; | |||||
GuildId = guildId; | |||||
ChannelId = channelId; | |||||
Topic = topic; | |||||
PrivacyLevel = privacyLevel; | |||||
DiscoverableDisabled = discoverableDisabled; | |||||
} | |||||
/// <summary> | |||||
/// The id of this Stage instance. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public Snowflake Id { get; } | |||||
/// <summary> | |||||
/// The guild id of the associated Stage channel. | |||||
/// </summary> | |||||
[JsonPropertyName("guild_id")] | |||||
public Snowflake GuildId { get; } | |||||
/// <summary> | |||||
/// The id of the associated Stage channel. | |||||
/// </summary> | |||||
[JsonPropertyName("channel_id")] | |||||
public Snowflake ChannelId { get; } | |||||
/// <summary> | |||||
/// The topic of the Stage instance (1-120 characters). | |||||
/// </summary> | |||||
[JsonPropertyName("topic")] | |||||
public string Topic { get; } | |||||
/// <summary> | |||||
/// The privacy level of the Stage instance. | |||||
/// </summary> | |||||
[JsonPropertyName("privacy_level")] | |||||
public PrivacyLevel PrivacyLevel { get; } | |||||
/// <summary> | |||||
/// Whether or not Stage discovery is disabled. | |||||
/// </summary> | |||||
[JsonPropertyName("discoverable_disabled")] | |||||
public bool DiscoverableDisabled { get; } | |||||
} | |||||
} |
@@ -1,20 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the membership state type. | |||||
/// </summary> | |||||
public enum MembershipState | |||||
{ | |||||
/// <summary> | |||||
/// This member has been invited, but did not accept yet. | |||||
/// </summary> | |||||
Invited = 1, | |||||
/// <summary> | |||||
/// This member accepted the invite. | |||||
/// </summary> | |||||
Accepted = 2, | |||||
} | |||||
} |
@@ -1,58 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a team object. | |||||
/// </summary> | |||||
public record Team | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="Team"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="icon">A hash of the image of the team's icon.</param> | |||||
/// <param name="id">The unique id of the team.</param> | |||||
/// <param name="members">The members of the team.</param> | |||||
/// <param name="name">The name of the team.</param> | |||||
/// <param name="ownerUserId">The user id of the current team owner.</param> | |||||
[JsonConstructor] | |||||
public Team(string? icon, Snowflake id, TeamMember[] members, string name, Snowflake ownerUserId) | |||||
{ | |||||
Icon = icon; | |||||
Id = id; | |||||
Members = members; | |||||
Name = name; | |||||
OwnerUserId = ownerUserId; | |||||
} | |||||
/// <summary> | |||||
/// A hash of the image of the team's icon. | |||||
/// </summary> | |||||
[JsonPropertyName("icon")] | |||||
public string? Icon { get; } | |||||
/// <summary> | |||||
/// The unique id of the team. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public Snowflake Id { get; } | |||||
/// <summary> | |||||
/// The members of the team. | |||||
/// </summary> | |||||
[JsonPropertyName("members")] | |||||
public TeamMember[] Members { get; } | |||||
/// <summary> | |||||
/// The name of the team. | |||||
/// </summary> | |||||
[JsonPropertyName("name")] | |||||
public string Name { get; } | |||||
/// <summary> | |||||
/// The user id of the current team owner. | |||||
/// </summary> | |||||
[JsonPropertyName("owner_user_id")] | |||||
public Snowflake OwnerUserId { get; } | |||||
} | |||||
} |
@@ -1,50 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a team member object. | |||||
/// </summary> | |||||
public record TeamMember | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="TeamMember"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="membershipState">The user's membership state on the team.</param> | |||||
/// <param name="permissions">Will always be ["*"].</param> | |||||
/// <param name="teamId">The id of the parent team of which they are a member.</param> | |||||
/// <param name="user">The avatar, discriminator, id, and username of the user.</param> | |||||
[JsonConstructor] | |||||
public TeamMember(MembershipState membershipState, string[] permissions, Snowflake teamId, User user) | |||||
{ | |||||
MembershipState = membershipState; | |||||
Permissions = permissions; | |||||
TeamId = teamId; | |||||
User = user; | |||||
} | |||||
/// <summary> | |||||
/// The user's membership state on the team. | |||||
/// </summary> | |||||
[JsonPropertyName("membership_state")] | |||||
public MembershipState MembershipState { get; } | |||||
/// <summary> | |||||
/// Will always be ["*"]. | |||||
/// </summary> | |||||
[JsonPropertyName("permissions")] | |||||
public string[] Permissions { get; } | |||||
/// <summary> | |||||
/// The id of the parent team of which they are a member. | |||||
/// </summary> | |||||
[JsonPropertyName("team_id")] | |||||
public Snowflake TeamId { get; } | |||||
/// <summary> | |||||
/// The avatar, discriminator, id, and username of the user. | |||||
/// </summary> | |||||
[JsonPropertyName("user")] | |||||
public User User { get; } | |||||
} | |||||
} |
@@ -1,90 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a connection object. | |||||
/// </summary> | |||||
public record Connection | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="Connection"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="id">Id of the connection account.</param> | |||||
/// <param name="name">The username of the connection account.</param> | |||||
/// <param name="type">The service of the connection (twitch, youtube).</param> | |||||
/// <param name="revoked">Whether the connection is revoked.</param> | |||||
/// <param name="integrations">An array of partial server integrations.</param> | |||||
/// <param name="verified">Whether the connection is verified.</param> | |||||
/// <param name="friendSync">Whether friend sync is enabled for this connection.</param> | |||||
/// <param name="showActivity">Whether activities related to this connection will be shown in presence updates.</param> | |||||
/// <param name="visibility">Visibility of this connection.</param> | |||||
[JsonConstructor] | |||||
public Connection(string id, string name, string type, Optional<bool> revoked, Optional<Integration[]> integrations, bool verified, bool friendSync, bool showActivity, VisibilityType visibility) | |||||
{ | |||||
Id = id; | |||||
Name = name; | |||||
Type = type; | |||||
Revoked = revoked; | |||||
Integrations = integrations; | |||||
Verified = verified; | |||||
FriendSync = friendSync; | |||||
ShowActivity = showActivity; | |||||
Visibility = visibility; | |||||
} | |||||
/// <summary> | |||||
/// Id of the connection account. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public string Id { get; } | |||||
/// <summary> | |||||
/// The username of the connection account. | |||||
/// </summary> | |||||
[JsonPropertyName("name")] | |||||
public string Name { get; } | |||||
/// <summary> | |||||
/// The service of the connection (twitch, youtube). | |||||
/// </summary> | |||||
[JsonPropertyName("type")] | |||||
public string Type { get; } | |||||
/// <summary> | |||||
/// Whether the connection is revoked. | |||||
/// </summary> | |||||
[JsonPropertyName("revoked")] | |||||
public Optional<bool> Revoked { get; } | |||||
/// <summary> | |||||
/// An array of partial server integrations. | |||||
/// </summary> | |||||
[JsonPropertyName("integrations")] | |||||
public Optional<Integration[]> Integrations { get; } | |||||
/// <summary> | |||||
/// Whether the connection is verified. | |||||
/// </summary> | |||||
[JsonPropertyName("verified")] | |||||
public bool Verified { get; } | |||||
/// <summary> | |||||
/// Whether friend sync is enabled for this connection. | |||||
/// </summary> | |||||
[JsonPropertyName("friend_sync")] | |||||
public bool FriendSync { get; } | |||||
/// <summary> | |||||
/// Whether activities related to this connection will be shown in presence updates. | |||||
/// </summary> | |||||
[JsonPropertyName("show_activity")] | |||||
public bool ShowActivity { get; } | |||||
/// <summary> | |||||
/// Visibility of this connection. | |||||
/// </summary> | |||||
[JsonPropertyName("visibility")] | |||||
public VisibilityType Visibility { get; } | |||||
} | |||||
} |
@@ -1,25 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the premium type. | |||||
/// </summary> | |||||
public enum PremiumType | |||||
{ | |||||
/// <summary> | |||||
/// User does not have Nitro. | |||||
/// </summary> | |||||
None = 0, | |||||
/// <summary> | |||||
/// User has Nitro Classic. | |||||
/// </summary> | |||||
NitroClassic = 1, | |||||
/// <summary> | |||||
/// User has Nitro. | |||||
/// </summary> | |||||
Nitro = 2, | |||||
} | |||||
} |
@@ -1,122 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a user object. | |||||
/// </summary> | |||||
public record User | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="User"/> 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> | |||||
[JsonConstructor] | |||||
public User(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) | |||||
{ | |||||
Id = id; | |||||
Username = username; | |||||
Discriminator = discriminator; | |||||
Avatar = avatar; | |||||
Bot = bot; | |||||
System = system; | |||||
MfaEnabled = mfaEnabled; | |||||
Locale = locale; | |||||
Verified = verified; | |||||
Email = email; | |||||
Flags = flags; | |||||
PremiumType = premiumType; | |||||
PublicFlags = publicFlags; | |||||
} | |||||
/// <summary> | |||||
/// The user's id. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public Snowflake Id { get; } | |||||
/// <summary> | |||||
/// The user's username, not unique across the platform. | |||||
/// </summary> | |||||
[JsonPropertyName("username")] | |||||
public string Username { get; } | |||||
/// <summary> | |||||
/// The user's 4-digit discord-tag. | |||||
/// </summary> | |||||
[JsonPropertyName("discriminator")] | |||||
public string Discriminator { get; } | |||||
/// <summary> | |||||
/// The user's avatar hash. | |||||
/// </summary> | |||||
[JsonPropertyName("avatar")] | |||||
public string? Avatar { get; } | |||||
/// <summary> | |||||
/// Whether the user belongs to an OAuth2 application. | |||||
/// </summary> | |||||
[JsonPropertyName("bot")] | |||||
public Optional<bool> Bot { get; } | |||||
/// <summary> | |||||
/// Whether the user is an Official Discord System user (part of the urgent message system). | |||||
/// </summary> | |||||
[JsonPropertyName("system")] | |||||
public Optional<bool> System { get; } | |||||
/// <summary> | |||||
/// Whether the user has two factor enabled on their account. | |||||
/// </summary> | |||||
[JsonPropertyName("mfa_enabled")] | |||||
public Optional<bool> MfaEnabled { get; } | |||||
/// <summary> | |||||
/// The user's chosen language option. | |||||
/// </summary> | |||||
[JsonPropertyName("locale")] | |||||
public Optional<string> Locale { get; } | |||||
/// <summary> | |||||
/// Whether the email on this account has been verified. | |||||
/// </summary> | |||||
[JsonPropertyName("verified")] | |||||
public Optional<bool> Verified { get; } | |||||
/// <summary> | |||||
/// The user's email. | |||||
/// </summary> | |||||
[JsonPropertyName("email")] | |||||
public Optional<string?> Email { get; } | |||||
/// <summary> | |||||
/// The flags on a user's account. | |||||
/// </summary> | |||||
[JsonPropertyName("flags")] | |||||
public Optional<UserFlags> Flags { get; } | |||||
/// <summary> | |||||
/// The type of Nitro subscription on a user's account. | |||||
/// </summary> | |||||
[JsonPropertyName("premium_type")] | |||||
public Optional<PremiumType> PremiumType { get; } | |||||
/// <summary> | |||||
/// The public flags on a user's account. | |||||
/// </summary> | |||||
[JsonPropertyName("public_flags")] | |||||
public Optional<UserFlags> PublicFlags { get; } | |||||
} | |||||
} |
@@ -1,81 +0,0 @@ | |||||
using System; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the user flags. | |||||
/// </summary> | |||||
[Flags] | |||||
public enum UserFlags | |||||
{ | |||||
/// <summary> | |||||
/// Default flag. | |||||
/// </summary> | |||||
None = 0, | |||||
/// <summary> | |||||
/// User is a Discord Employee. | |||||
/// </summary> | |||||
DiscordEmployee = 1 << 0, | |||||
/// <summary> | |||||
/// User is the owner of a partnered server. | |||||
/// </summary> | |||||
PartneredServerOwner = 1 << 1, | |||||
/// <summary> | |||||
/// User participated in HypeSquad events. | |||||
/// </summary> | |||||
HypeSquadEvents = 1 << 2, | |||||
/// <summary> | |||||
/// User is a level 1 Bug Hunter. | |||||
/// </summary> | |||||
BugHunterLevel1 = 1 << 3, | |||||
/// <summary> | |||||
/// User is part of House Bravery. | |||||
/// </summary> | |||||
HouseBravery = 1 << 6, | |||||
/// <summary> | |||||
/// User is part of House Brilliance. | |||||
/// </summary> | |||||
HouseBrilliance = 1 << 7, | |||||
/// <summary> | |||||
/// User is part of House Balance. | |||||
/// </summary> | |||||
HouseBalance = 1 << 8, | |||||
/// <summary> | |||||
/// User is an early supporter. | |||||
/// </summary> | |||||
EarlySupporter = 1 << 9, | |||||
/// <summary> | |||||
/// User is part of a team. | |||||
/// </summary> | |||||
TeamUser = 1 << 10, | |||||
/// <summary> | |||||
/// User is a level 2 Bug Hunter. | |||||
/// </summary> | |||||
BugHunterLevel2 = 1 << 14, | |||||
/// <summary> | |||||
/// User is a verified bot. | |||||
/// </summary> | |||||
VerifiedBot = 1 << 16, | |||||
/// <summary> | |||||
/// User is an early verified bot developer. | |||||
/// </summary> | |||||
EarlyVerifiedBotDeveloper = 1 << 17, | |||||
/// <summary> | |||||
/// User is a Discord certified moderator. | |||||
/// </summary> | |||||
DiscordCertifiedModerator = 1 << 18, | |||||
} | |||||
} |
@@ -1,18 +0,0 @@ | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents the visibility type. | |||||
/// </summary> | |||||
public enum VisibilityType | |||||
{ | |||||
/// <summary> | |||||
/// Invisible to everyone except the user themselves. | |||||
/// </summary> | |||||
None = 0, | |||||
/// <summary> | |||||
/// Visible to everyone. | |||||
/// </summary> | |||||
Everyone = 1, | |||||
} | |||||
} |
@@ -1,66 +0,0 @@ | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a voice region object. | |||||
/// </summary> | |||||
public record VoiceRegion | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="VoiceRegion"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="id">Unique ID for the region.</param> | |||||
/// <param name="name">Name of the region.</param> | |||||
/// <param name="vip">True if this is a vip-only server.</param> | |||||
/// <param name="optimal">True for a single server that is closest to the current user's client.</param> | |||||
/// <param name="deprecated">Whether this is a deprecated voice region (avoid switching to these).</param> | |||||
/// <param name="custom">Whether this is a custom voice region (used for events/etc).</param> | |||||
[JsonConstructor] | |||||
public VoiceRegion(string id, string name, bool vip, bool optimal, bool deprecated, bool custom) | |||||
{ | |||||
Id = id; | |||||
Name = name; | |||||
Vip = vip; | |||||
Optimal = optimal; | |||||
Deprecated = deprecated; | |||||
Custom = custom; | |||||
} | |||||
/// <summary> | |||||
/// Unique ID for the region. | |||||
/// </summary> | |||||
[JsonPropertyName("id")] | |||||
public string Id { get; } | |||||
/// <summary> | |||||
/// Name of the region. | |||||
/// </summary> | |||||
[JsonPropertyName("name")] | |||||
public string Name { get; } | |||||
/// <summary> | |||||
/// True if this is a vip-only server. | |||||
/// </summary> | |||||
[JsonPropertyName("vip")] | |||||
public bool Vip { get; } | |||||
/// <summary> | |||||
/// True for a single server that is closest to the current user's client. | |||||
/// </summary> | |||||
[JsonPropertyName("optimal")] | |||||
public bool Optimal { get; } | |||||
/// <summary> | |||||
/// Whether this is a deprecated voice region (avoid switching to these). | |||||
/// </summary> | |||||
[JsonPropertyName("deprecated")] | |||||
public bool Deprecated { get; } | |||||
/// <summary> | |||||
/// Whether this is a custom voice region (used for events/etc). | |||||
/// </summary> | |||||
[JsonPropertyName("custom")] | |||||
public bool Custom { get; } | |||||
} | |||||
} |
@@ -1,123 +0,0 @@ | |||||
using System; | |||||
using System.Text.Json.Serialization; | |||||
namespace Discord.Net.Models | |||||
{ | |||||
/// <summary> | |||||
/// Represents a voice state object. | |||||
/// </summary> | |||||
public record VoiceState | |||||
{ | |||||
/// <summary> | |||||
/// Creates a <see cref="VoiceState"/> with the provided parameters. | |||||
/// </summary> | |||||
/// <param name="guildId">The guild id this voice state is for.</param> | |||||
/// <param name="channelId">The channel id this user is connected to.</param> | |||||
/// <param name="userId">The user id this voice state is for.</param> | |||||
/// <param name="member">The guild member this voice state is for.</param> | |||||
/// <param name="sessionId">The session id for this voice state.</param> | |||||
/// <param name="deaf">Whether this user is deafened by the server.</param> | |||||
/// <param name="mute">Whether this user is muted by the server.</param> | |||||
/// <param name="selfDeaf">Whether this user is locally deafened.</param> | |||||
/// <param name="selfMute">Whether this user is locally muted.</param> | |||||
/// <param name="selfStream">Whether this user is streaming using "Go Live".</param> | |||||
/// <param name="selfVideo">Whether this user's camera is enabled.</param> | |||||
/// <param name="suppress">Whether this user is muted by the current user.</param> | |||||
/// <param name="requestToSpeakTimestamp">The time at which the user requested to speak.</param> | |||||
[JsonConstructor] | |||||
public VoiceState(Optional<Snowflake> guildId, Snowflake? channelId, Snowflake userId, Optional<GuildMember> member, string sessionId, bool deaf, bool mute, bool selfDeaf, bool selfMute, Optional<bool> selfStream, bool selfVideo, bool suppress, DateTimeOffset? requestToSpeakTimestamp) | |||||
{ | |||||
GuildId = guildId; | |||||
ChannelId = channelId; | |||||
UserId = userId; | |||||
Member = member; | |||||
SessionId = sessionId; | |||||
Deaf = deaf; | |||||
Mute = mute; | |||||
SelfDeaf = selfDeaf; | |||||
SelfMute = selfMute; | |||||
SelfStream = selfStream; | |||||
SelfVideo = selfVideo; | |||||
Suppress = suppress; | |||||
RequestToSpeakTimestamp = requestToSpeakTimestamp; | |||||
} | |||||
/// <summary> | |||||
/// The guild id this voice state is for. | |||||
/// </summary> | |||||
[JsonPropertyName("guild_id")] | |||||
public Optional<Snowflake> GuildId { get; } | |||||
/// <summary> | |||||
/// The channel id this user is connected to. | |||||
/// </summary> | |||||
[JsonPropertyName("channel_id")] | |||||
public Snowflake? ChannelId { get; } | |||||
/// <summary> | |||||
/// The user id this voice state is for. | |||||
/// </summary> | |||||
[JsonPropertyName("user_id")] | |||||
public Snowflake UserId { get; } | |||||
/// <summary> | |||||
/// The guild member this voice state is for. | |||||
/// </summary> | |||||
[JsonPropertyName("member")] | |||||
public Optional<GuildMember> Member { get; } | |||||
/// <summary> | |||||
/// The session id for this voice state. | |||||
/// </summary> | |||||
[JsonPropertyName("session_id")] | |||||
public string SessionId { get; } | |||||
/// <summary> | |||||
/// Whether this user is deafened by the server. | |||||
/// </summary> | |||||
[JsonPropertyName("deaf")] | |||||
public bool Deaf { get; } | |||||
/// <summary> | |||||
/// Whether this user is muted by the server. | |||||
/// </summary> | |||||
[JsonPropertyName("mute")] | |||||
public bool Mute { get; } | |||||
/// <summary> | |||||
/// Whether this user is locally deafened. | |||||
/// </summary> | |||||
[JsonPropertyName("self_deaf")] | |||||
public bool SelfDeaf { get; } | |||||
/// <summary> | |||||
/// Whether this user is locally muted. | |||||
/// </summary> | |||||
[JsonPropertyName("self_mute")] | |||||
public bool SelfMute { get; } | |||||
/// <summary> | |||||
/// Whether this user is streaming using "Go Live". | |||||
/// </summary> | |||||
[JsonPropertyName("self_stream")] | |||||
public Optional<bool> SelfStream { get; } | |||||
/// <summary> | |||||
/// Whether this user's camera is enabled. | |||||
/// </summary> | |||||
[JsonPropertyName("self_video")] | |||||
public bool SelfVideo { get; } | |||||
/// <summary> | |||||
/// Whether this user is muted by the current user. | |||||
/// </summary> | |||||
[JsonPropertyName("suppress")] | |||||
public bool Suppress { get; } | |||||
/// <summary> | |||||
/// The time at which the user requested to speak. | |||||
/// </summary> | |||||
[JsonPropertyName("request_to_speak_timestamp")] | |||||
public DateTimeOffset? RequestToSpeakTimestamp { get; } | |||||
} | |||||
} |