From d205dbb763f79724737c1e7ab68cdc9e094bd6ea Mon Sep 17 00:00:00 2001 From: discord-net Date: Fri, 15 Mar 2024 05:10:29 +0000 Subject: [PATCH] Update from https://github.com/discord-net/Discord.Net/commit/3331614a7a084b74326acfd6d3ceb927e02c511e --- docs/CNAME | 1 - docs/api/Discord.Rest.RestGroupUser.html | 3 + docs/api/Discord.Rest.RestGuildUser.html | 3 + docs/api/Discord.Rest.RestSelfUser.html | 3 + docs/api/Discord.Rest.RestUser.html | 85 +++++++++++++----- docs/api/Discord.Rest.RestWebhookUser.html | 3 + docs/api/Discord.SelfUserProperties.html | 32 +++++++ docs/api/Discord.WebSocket.SocketGuild.html | 20 ++--- .../api/Discord.WebSocket.SocketSelfUser.html | 90 ++++++++++++++++--- docs/guides/int_framework/intro.html | 66 ++++++++++---- docs/index.json | 16 ++-- docs/public/main.css | 16 +++- docs/public/main.js | 61 ++++++++++++- docs/xrefmap.yml | 52 +++++++++++ 14 files changed, 379 insertions(+), 72 deletions(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index a369215c..00000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -docs.discordnet.dev \ No newline at end of file diff --git a/docs/api/Discord.Rest.RestGroupUser.html b/docs/api/Discord.Rest.RestGroupUser.html index 475e334e..b6cdfef0 100644 --- a/docs/api/Discord.Rest.RestGroupUser.html +++ b/docs/api/Discord.Rest.RestGroupUser.html @@ -151,6 +151,9 @@

RestUser.BannerId +
+ RestUser.BannerColor +
RestUser.AccentColor
diff --git a/docs/api/Discord.Rest.RestGuildUser.html b/docs/api/Discord.Rest.RestGuildUser.html index 639a49db..0a62bdd2 100644 --- a/docs/api/Discord.Rest.RestGuildUser.html +++ b/docs/api/Discord.Rest.RestGuildUser.html @@ -151,6 +151,9 @@

RestUser.BannerId +
+ RestUser.BannerColor +
RestUser.AccentColor
diff --git a/docs/api/Discord.Rest.RestSelfUser.html b/docs/api/Discord.Rest.RestSelfUser.html index b0f574b0..4cf8746a 100644 --- a/docs/api/Discord.Rest.RestSelfUser.html +++ b/docs/api/Discord.Rest.RestSelfUser.html @@ -150,6 +150,9 @@

RestUser.BannerId +
+ RestUser.BannerColor +
RestUser.AccentColor
diff --git a/docs/api/Discord.Rest.RestUser.html b/docs/api/Discord.Rest.RestUser.html index 99a4804e..0b1c6919 100644 --- a/docs/api/Discord.Rest.RestUser.html +++ b/docs/api/Discord.Rest.RestUser.html @@ -197,7 +197,7 @@

Properties

AccentColor - +

@@ -228,7 +228,7 @@

Property Value

ActiveClients - +

Gets the set of clients where this user is currently active.

@@ -260,7 +260,7 @@

Property Value

Activities - +

Gets the list of activities that this user currently has available.

@@ -292,7 +292,7 @@

Property Value

Activity - +

@@ -323,7 +323,7 @@

Property Value

AvatarDecorationHash - +

Gets the hash of the avatar decoration.

@@ -358,7 +358,7 @@

Rema

AvatarDecorationSkuId - +

Gets the id of the avatar decoration's SKU.

@@ -421,14 +421,50 @@

Property Value

+ + +

+ BannerColor + +

+ +

Gets the color of the banner.

+
+
+ +
+
public Color? BannerColor { get; }
+
+ + + + + +

Property Value

+
+
Color?
+
+
+ + + + +

Remarks

+

null if the user has no banner set.

+
+ + + +

BannerId - +

-
+

Gets the hash of the banner.

+
@@ -448,6 +484,9 @@

Property Value

+

Remarks

+

null if the user has no banner set.

+
@@ -456,7 +495,7 @@

Property Value

CreatedAt - +

Gets when the snowflake was created.

@@ -489,7 +528,7 @@

Property Value

Discriminator - +

Gets the per-username unique ID for this user. This will return "0000" for users who have migrated to new username system.

@@ -553,7 +592,7 @@

Property Value

GlobalName - +

Gets the user's display name, if it is set. For bots, this will get the application name.

@@ -625,7 +664,7 @@

Remarks

IsWebhook - +

Gets a value that indicates whether this user is a webhook user.

@@ -658,7 +697,7 @@

Property Value

Mention - +

Returns a special string used to mention this object.

@@ -691,7 +730,7 @@

Property Value

PublicFlags - +

Gets the public flags that are applied to this user's account.

@@ -727,7 +766,7 @@

Remarks

Status - +

Gets the current status of this user.

@@ -795,7 +834,7 @@

Methods

CreateDMChannelAsync(RequestOptions) - +

Creates a direct message channel to this user.

@@ -834,7 +873,7 @@

Returns

GetAvatarDecorationUrl() - +

Gets the URL for user's avatar decoration.

@@ -869,7 +908,7 @@

Re

GetAvatarUrl(ImageFormat, ushort) - +

Gets the avatar URL for this user, if it is set.

@@ -926,7 +965,7 @@
tip

GetBannerUrl(ImageFormat, ushort) - +

@@ -964,7 +1003,7 @@

Returns

GetDefaultAvatarUrl() - +

Gets the default avatar URL for this user.

@@ -1003,7 +1042,7 @@

Remar

GetDisplayAvatarUrl(ImageFormat, ushort) - +

Gets the display avatar URL for this user.

@@ -1048,7 +1087,7 @@

ToString() - +

Gets the Username#Discriminator of the user.

@@ -1081,7 +1120,7 @@

Returns

UpdateAsync(RequestOptions) - +

Updates this object's properties with its current state.

diff --git a/docs/api/Discord.Rest.RestWebhookUser.html b/docs/api/Discord.Rest.RestWebhookUser.html index 6178367b..b257649e 100644 --- a/docs/api/Discord.Rest.RestWebhookUser.html +++ b/docs/api/Discord.Rest.RestWebhookUser.html @@ -151,6 +151,9 @@

RestUser.BannerId

+ diff --git a/docs/api/Discord.SelfUserProperties.html b/docs/api/Discord.SelfUserProperties.html index e0284606..b86119da 100644 --- a/docs/api/Discord.SelfUserProperties.html +++ b/docs/api/Discord.SelfUserProperties.html @@ -195,6 +195,38 @@

Property Value

+ + +

+ Banner + +

+ +

Gets or sets the banner.

+
+
+ +
+
public Optional<Image?> Banner { get; set; }
+
+ + + + + +

Property Value

+
+
Optional<Image?>
+
+
+ + + + + + + +

diff --git a/docs/api/Discord.WebSocket.SocketGuild.html b/docs/api/Discord.WebSocket.SocketGuild.html index 276ecb0f..32294f37 100644 --- a/docs/api/Discord.WebSocket.SocketGuild.html +++ b/docs/api/Discord.WebSocket.SocketGuild.html @@ -318,7 +318,7 @@

Property Value

AutoModRules - +

Gets the auto moderation rules defined in this guild.

@@ -2766,7 +2766,7 @@

Returns

CreateAutoModRuleAsync(Action<AutoModRuleProperties>, RequestOptions) - +

Creates a new auto moderation rule.

@@ -3889,7 +3889,7 @@

Returns

GetAutoModRule(ulong) - +

Gets a single rule configured in a guild from cache. Returns null if the rule was not found.

@@ -3926,7 +3926,7 @@

Returns

GetAutoModRuleAsync(ulong, RequestOptions) - +

Gets a single rule configured in a guild. Returns null if the rule was not found.

@@ -3966,7 +3966,7 @@

Returns

GetAutoModRulesAsync(RequestOptions) - +

Get a list of all rules currently configured for the guild.

@@ -4797,7 +4797,7 @@

Returns

GetOnboardingAsync(RequestOptions) - +

Gets the onboarding object configured for the guild.

@@ -5411,7 +5411,7 @@

Returns

GetWelcomeScreenAsync(RequestOptions) - +

Gets the welcome screen of the guild. Returns null if the welcome channel is not set.

@@ -5634,7 +5634,7 @@

Returns

ModifyOnboardingAsync(Action<GuildOnboardingProperties>, RequestOptions) - +

Modifies the onboarding object configured for the guild.

@@ -5674,7 +5674,7 @@

Returns

ModifyWelcomeScreenAsync(bool, WelcomeScreenChannelProperties[], string, RequestOptions) - +

Modifies the welcome screen of the guild. Returns null if welcome screen is removed.

@@ -6144,7 +6144,7 @@

ToString() - +

Gets the name of the guild.

diff --git a/docs/api/Discord.WebSocket.SocketSelfUser.html b/docs/api/Discord.WebSocket.SocketSelfUser.html index 1955fd89..30166143 100644 --- a/docs/api/Discord.WebSocket.SocketSelfUser.html +++ b/docs/api/Discord.WebSocket.SocketSelfUser.html @@ -237,7 +237,7 @@

Properties

AvatarId - +

Gets the identifier of this user's avatar.

@@ -265,11 +265,81 @@

Property Value

+ + +

+ BannerColor + +

+ +

Gets the color of the banner.

+
+
+ +
+
public Color? BannerColor { get; }
+
+ + + + + +

Property Value

+
+
Color?
+
+
+ + + + +

Remarks

+

null if the user has no banner set.

+
+ + + + + + +

+ BannerId + +

+ +

Gets the hash of the banner.

+
+
+ +
+
public string BannerId { get; }
+
+ + + + + +

Property Value

+
+
string
+
+
+ + + + +

Remarks

+

null if the user has no banner set.

+
+ + + +

DiscriminatorValue - +

Gets the per-username unique ID for this user. This will return 0 for users who have migrated to new username system.

@@ -333,7 +403,7 @@

Property Value

Flags - +

Gets the flags that are applied to a user's account.

@@ -369,7 +439,7 @@

Remarks<

GlobalName - +

Gets the user's display name, if it is set. For bots, this will get the application name.

@@ -404,7 +474,7 @@

Rem

IsBot - +

Gets a value that indicates whether this user is identified as a bot.

@@ -507,7 +577,7 @@

Property Value

IsWebhook - +

Gets a value that indicates whether this user is a webhook user.

@@ -540,7 +610,7 @@

Property Value

Locale - +

Gets the user's chosen language option.

@@ -574,7 +644,7 @@

Property Value

PremiumType - +

Gets the type of Nitro subscription that is active on this user's account.

@@ -610,7 +680,7 @@

Re

Username - +

Gets the username for this user.

@@ -646,7 +716,7 @@

Methods

ModifyAsync(Action<SelfUserProperties>, RequestOptions) - +

Modifies the user's properties.

diff --git a/docs/guides/int_framework/intro.html b/docs/guides/int_framework/intro.html index ecf02bca..8d9bff37 100644 --- a/docs/guides/int_framework/intro.html +++ b/docs/guides/int_framework/intro.html @@ -105,8 +105,8 @@

Modules

A new module instance is created before a command execution starts then it will be disposed right after the method returns.

Every module class must:

Optionally you can override the included :

    @@ -174,7 +174,7 @@

    Commands

    Note
    -

    a TypeConverter that is capable of parsing type in question must be registered to the InteractionService instance. +

    A TypeConverter that is capable of parsing type in question must be registered to the InteractionService instance. You should avoid using long running code in your command module. Depending on your setup, long running code may block the Gateway thread of your bot, interrupting its connection to Discord.

    @@ -207,22 +207,58 @@

    Slash Commands

  • sbyte, byte
  • int16, int32, int64
  • uint16, uint32, uint64
  • -
  • enum (Values are registered as multiple choice options and are enforced by Discord. Use the [Hide] attribute on enum values to prevent them from getting registered.)
  • +
  • enum
  • DateTime
  • TimeSpan
+
+
Note
+

Enum values are registered as multiple choice options and are enforced by Discord. Use the [Hide] attribute on enum values to prevent them from getting registered.

+

-

*You can use more specialized implementations of IChannel to restrict the allowed channel types for a channel type option. -| interface | Channel Type | -|---------------------|-------------------------------| -| IStageChannel | Stage Channels | -| IVoiceChannel | Voice Channels | -| IDMChannel | DM Channels | -| IGroupChannel | Group Channels | -| ICategoryChannel | Category Channels | -| INewsChannel | News Channels | -| IThreadChannel | Public, Private, News Threads | -| ITextChannel | Text Channels |

+

You can use more specialized implementations of IChannel to restrict the allowed channel types for a channel type option.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
interfaceChannel Type
IStageChannelStage Channels
IVoiceChannelVoice Channels
IDMChannelDM Channels
IGroupChannelGroup Channels
ICategoryChannelCategory Channels
INewsChannelNews Channels
IThreadChannelPublic, Private, News Threads
ITextChannelText Channels

Optional Parameters

Parameters with default values (ie. int count = 0) will be displayed as optional parameters on Discord Client.

diff --git a/docs/index.json b/docs/index.json index 4d72d0bb..8ade94d3 100644 --- a/docs/index.json +++ b/docs/index.json @@ -2787,7 +2787,7 @@ "api/Discord.Rest.RestGroupUser.html": { "href": "api/Discord.Rest.RestGroupUser.html", "title": "Class RestGroupUser | Discord.Net Documentation", - "keywords": "Class RestGroupUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents a REST-based group user. public class RestGroupUser : RestUser, IUpdateable, IGroupUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IVoiceState Inheritance object RestEntity RestUser RestGroupUser Implements IUpdateable IGroupUser IUser ISnowflakeEntity IEntity IMentionable IPresence IVoiceState Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.IsWebhook RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.UpdateAsync(RequestOptions) RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetDisplayAvatarUrl(ImageFormat, ushort) RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[])" + "keywords": "Class RestGroupUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents a REST-based group user. public class RestGroupUser : RestUser, IUpdateable, IGroupUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IVoiceState Inheritance object RestEntity RestUser RestGroupUser Implements IUpdateable IGroupUser IUser ISnowflakeEntity IEntity IMentionable IPresence IVoiceState Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.BannerColor RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.IsWebhook RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.UpdateAsync(RequestOptions) RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetDisplayAvatarUrl(ImageFormat, ushort) RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[])" }, "api/Discord.Rest.RestGuild.html": { "href": "api/Discord.Rest.RestGuild.html", @@ -2827,7 +2827,7 @@ "api/Discord.Rest.RestGuildUser.html": { "href": "api/Discord.Rest.RestGuildUser.html", "title": "Class RestGuildUser | Discord.Net Documentation", - "keywords": "Class RestGuildUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents a REST-based guild user. public class RestGuildUser : RestUser, IUpdateable, IGuildUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IVoiceState Inheritance object RestEntity RestUser RestGuildUser Implements IUpdateable IGuildUser IUser ISnowflakeEntity IEntity IMentionable IPresence IVoiceState Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.IsWebhook RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.BanAsync(IGuildUser, int, string, RequestOptions) UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties DisplayAvatarId Gets the displayed avatar for this user. public string DisplayAvatarId { get; } Property Value string The users displayed avatar hash. If the user does not have a guild avatar, this will be the regular avatar. If the user also does not have a regular avatar, this will be null. DisplayName Gets the displayed name for this user. public string DisplayName { get; } Property Value string A string representing the display name of the user; If the nickname is null, this will be the username. Flags Gets the public flags for this guild member. public GuildUserFlags Flags { get; } Property Value GuildUserFlags GuildAvatarId Gets the guild specific avatar for this user. public string GuildAvatarId { get; } Property Value string The users guild avatar hash if they have one; otherwise null. GuildId Gets the ID of the guild for this user. public ulong GuildId { get; } Property Value ulong An ulong representing the snowflake identifier of the guild that this user belongs to. GuildPermissions Gets the guild-level permissions for this user. public GuildPermissions GuildPermissions { get; } Property Value GuildPermissions A GuildPermissions structure for this user, representing what permissions this user has in the guild. Exceptions InvalidOperationException Resolving permissions requires the parent guild to be downloaded. Hierarchy Gets the users position within the role hierarchy. public int Hierarchy { get; } Property Value int IsDeafened Gets a value that indicates whether this user is deafened by the guild. public bool IsDeafened { get; } Property Value bool true if the user is deafened (i.e. not permitted to listen to or speak to others) by the guild; otherwise false. IsMuted Gets a value that indicates whether this user is muted (i.e. not permitted to speak via voice) by the guild. public bool IsMuted { get; } Property Value bool true if this user is muted by the guild; otherwise false. IsPending Whether the user has passed the guild's Membership Screening requirements. public bool? IsPending { get; } Property Value bool? JoinedAt Gets when this user joined the guild. public DateTimeOffset? JoinedAt { get; } Property Value DateTimeOffset? A DateTimeOffset representing the time of which the user has joined the guild; null when it cannot be obtained. Nickname Gets the nickname for this user. public string Nickname { get; } Property Value string A string representing the nickname of the user; null if none is set. PremiumSince Gets the date and time for when this user's guild boost began. public DateTimeOffset? PremiumSince { get; } Property Value DateTimeOffset? A DateTimeOffset for when the user began boosting this guild; null if they are not boosting the guild. RoleIds Gets a collection of IDs for the roles that this user currently possesses in the guild. public IReadOnlyCollection RoleIds { get; } Property Value IReadOnlyCollection A read-only collection of ulong, each representing a snowflake identifier for a role that this user possesses. Remarks This property returns a read-only collection of the identifiers of the roles that this user possesses. For WebSocket users, a Roles property can be found in place of this property. Due to the REST implementation, only a collection of identifiers can be retrieved instead of the full role objects. TimedOutUntil Gets the date and time that indicates if and for how long a user has been timed out. public DateTimeOffset? TimedOutUntil { get; } Property Value DateTimeOffset? A DateTimeOffset indicating how long the user will be timed out for. Remarks null or a timestamp in the past if the user is not timed out. Methods AddRoleAsync(IRole, RequestOptions) Adds the specified role to this user in the guild. public Task AddRoleAsync(IRole role, RequestOptions options = null) Parameters role IRole The role to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. AddRoleAsync(ulong, RequestOptions) Adds the specified role to this user in the guild. public Task AddRoleAsync(ulong roleId, RequestOptions options = null) Parameters roleId ulong The role to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. AddRolesAsync(IEnumerable, RequestOptions) Adds the specified roles to this user in the guild. public Task AddRolesAsync(IEnumerable roles, RequestOptions options = null) Parameters roles IEnumerable The roles to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. AddRolesAsync(IEnumerable, RequestOptions) Adds the specified roleIds to this user in the guild. public Task AddRolesAsync(IEnumerable roleIds, RequestOptions options = null) Parameters roleIds IEnumerable The roles to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. GetDisplayAvatarUrl(ImageFormat, ushort) Gets the display avatar URL for this user. public override string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's display avatar URL. Remarks This method will return GetDefaultAvatarUrl() if the user has no avatar set. GetGuildAvatarUrl(ImageFormat, ushort) Gets the guild-specific avatar URL for this user, if it is set. public string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's guild-specific avatar URL; null if the user has no guild avatar set. Remarks tip If you wish to retrieve the display avatar for this user, consider using GetDisplayAvatarUrl(ImageFormat, ushort). GetPermissions(IGuildChannel) Gets the level permissions granted to this user to a given channel. public ChannelPermissions GetPermissions(IGuildChannel channel) Parameters channel IGuildChannel The channel to get the permission from. Returns ChannelPermissions A ChannelPermissions structure representing the permissions that a user has in the specified channel. Examples The following example checks if the current user has the ability to send a message with attachment in this channel; if so, uploads a file via SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags). if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) await targetChannel.SendFileAsync(\"fortnite.png\"); Exceptions InvalidOperationException Resolving permissions requires the parent guild to be downloaded. KickAsync(string, RequestOptions) Kicks this user from this guild. public Task KickAsync(string reason = null, RequestOptions options = null) Parameters reason string The reason for the kick which will be recorded in the audit log. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous kick operation. ModifyAsync(Action, RequestOptions) Modifies this user's properties in this guild. public Task ModifyAsync(Action func, RequestOptions options = null) Parameters func Action The delegate containing the properties to modify the user with. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous modification operation. Remarks This method modifies the current guild user with the specified properties. To see an example of this method and what properties are available, please refer to GuildUserProperties. RemoveRoleAsync(IRole, RequestOptions) Removes the specified role from this user in the guild. public Task RemoveRoleAsync(IRole role, RequestOptions options = null) Parameters role IRole The role to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveRoleAsync(ulong, RequestOptions) Removes the specified roleId from this user in the guild. public Task RemoveRoleAsync(ulong roleId, RequestOptions options = null) Parameters roleId ulong The role to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveRolesAsync(IEnumerable, RequestOptions) Removes the specified roles from this user in the guild. public Task RemoveRolesAsync(IEnumerable roles, RequestOptions options = null) Parameters roles IEnumerable The roles to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveRolesAsync(IEnumerable, RequestOptions) Removes the specified roleIds from this user in the guild. public Task RemoveRolesAsync(IEnumerable roleIds, RequestOptions options = null) Parameters roleIds IEnumerable The roles to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveTimeOutAsync(RequestOptions) Removes the current timeout from the user in this guild if one exists. public Task RemoveTimeOutAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous timeout removal operation. SetTimeOutAsync(TimeSpan, RequestOptions) Sets a timeout based on provided TimeSpan to this user in the guild. public Task SetTimeOutAsync(TimeSpan span, RequestOptions options = null) Parameters span TimeSpan The TimeSpan indicating how long a user should be timed out for. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous timeout creation operation. UpdateAsync(RequestOptions) Updates this object's properties with its current state. public override Task UpdateAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task" + "keywords": "Class RestGuildUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents a REST-based guild user. public class RestGuildUser : RestUser, IUpdateable, IGuildUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IVoiceState Inheritance object RestEntity RestUser RestGuildUser Implements IUpdateable IGuildUser IUser ISnowflakeEntity IEntity IMentionable IPresence IVoiceState Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.BannerColor RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.IsWebhook RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.BanAsync(IGuildUser, int, string, RequestOptions) UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties DisplayAvatarId Gets the displayed avatar for this user. public string DisplayAvatarId { get; } Property Value string The users displayed avatar hash. If the user does not have a guild avatar, this will be the regular avatar. If the user also does not have a regular avatar, this will be null. DisplayName Gets the displayed name for this user. public string DisplayName { get; } Property Value string A string representing the display name of the user; If the nickname is null, this will be the username. Flags Gets the public flags for this guild member. public GuildUserFlags Flags { get; } Property Value GuildUserFlags GuildAvatarId Gets the guild specific avatar for this user. public string GuildAvatarId { get; } Property Value string The users guild avatar hash if they have one; otherwise null. GuildId Gets the ID of the guild for this user. public ulong GuildId { get; } Property Value ulong An ulong representing the snowflake identifier of the guild that this user belongs to. GuildPermissions Gets the guild-level permissions for this user. public GuildPermissions GuildPermissions { get; } Property Value GuildPermissions A GuildPermissions structure for this user, representing what permissions this user has in the guild. Exceptions InvalidOperationException Resolving permissions requires the parent guild to be downloaded. Hierarchy Gets the users position within the role hierarchy. public int Hierarchy { get; } Property Value int IsDeafened Gets a value that indicates whether this user is deafened by the guild. public bool IsDeafened { get; } Property Value bool true if the user is deafened (i.e. not permitted to listen to or speak to others) by the guild; otherwise false. IsMuted Gets a value that indicates whether this user is muted (i.e. not permitted to speak via voice) by the guild. public bool IsMuted { get; } Property Value bool true if this user is muted by the guild; otherwise false. IsPending Whether the user has passed the guild's Membership Screening requirements. public bool? IsPending { get; } Property Value bool? JoinedAt Gets when this user joined the guild. public DateTimeOffset? JoinedAt { get; } Property Value DateTimeOffset? A DateTimeOffset representing the time of which the user has joined the guild; null when it cannot be obtained. Nickname Gets the nickname for this user. public string Nickname { get; } Property Value string A string representing the nickname of the user; null if none is set. PremiumSince Gets the date and time for when this user's guild boost began. public DateTimeOffset? PremiumSince { get; } Property Value DateTimeOffset? A DateTimeOffset for when the user began boosting this guild; null if they are not boosting the guild. RoleIds Gets a collection of IDs for the roles that this user currently possesses in the guild. public IReadOnlyCollection RoleIds { get; } Property Value IReadOnlyCollection A read-only collection of ulong, each representing a snowflake identifier for a role that this user possesses. Remarks This property returns a read-only collection of the identifiers of the roles that this user possesses. For WebSocket users, a Roles property can be found in place of this property. Due to the REST implementation, only a collection of identifiers can be retrieved instead of the full role objects. TimedOutUntil Gets the date and time that indicates if and for how long a user has been timed out. public DateTimeOffset? TimedOutUntil { get; } Property Value DateTimeOffset? A DateTimeOffset indicating how long the user will be timed out for. Remarks null or a timestamp in the past if the user is not timed out. Methods AddRoleAsync(IRole, RequestOptions) Adds the specified role to this user in the guild. public Task AddRoleAsync(IRole role, RequestOptions options = null) Parameters role IRole The role to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. AddRoleAsync(ulong, RequestOptions) Adds the specified role to this user in the guild. public Task AddRoleAsync(ulong roleId, RequestOptions options = null) Parameters roleId ulong The role to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. AddRolesAsync(IEnumerable, RequestOptions) Adds the specified roles to this user in the guild. public Task AddRolesAsync(IEnumerable roles, RequestOptions options = null) Parameters roles IEnumerable The roles to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. AddRolesAsync(IEnumerable, RequestOptions) Adds the specified roleIds to this user in the guild. public Task AddRolesAsync(IEnumerable roleIds, RequestOptions options = null) Parameters roleIds IEnumerable The roles to be added to the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role addition operation. GetDisplayAvatarUrl(ImageFormat, ushort) Gets the display avatar URL for this user. public override string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's display avatar URL. Remarks This method will return GetDefaultAvatarUrl() if the user has no avatar set. GetGuildAvatarUrl(ImageFormat, ushort) Gets the guild-specific avatar URL for this user, if it is set. public string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's guild-specific avatar URL; null if the user has no guild avatar set. Remarks tip If you wish to retrieve the display avatar for this user, consider using GetDisplayAvatarUrl(ImageFormat, ushort). GetPermissions(IGuildChannel) Gets the level permissions granted to this user to a given channel. public ChannelPermissions GetPermissions(IGuildChannel channel) Parameters channel IGuildChannel The channel to get the permission from. Returns ChannelPermissions A ChannelPermissions structure representing the permissions that a user has in the specified channel. Examples The following example checks if the current user has the ability to send a message with attachment in this channel; if so, uploads a file via SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags). if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) await targetChannel.SendFileAsync(\"fortnite.png\"); Exceptions InvalidOperationException Resolving permissions requires the parent guild to be downloaded. KickAsync(string, RequestOptions) Kicks this user from this guild. public Task KickAsync(string reason = null, RequestOptions options = null) Parameters reason string The reason for the kick which will be recorded in the audit log. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous kick operation. ModifyAsync(Action, RequestOptions) Modifies this user's properties in this guild. public Task ModifyAsync(Action func, RequestOptions options = null) Parameters func Action The delegate containing the properties to modify the user with. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous modification operation. Remarks This method modifies the current guild user with the specified properties. To see an example of this method and what properties are available, please refer to GuildUserProperties. RemoveRoleAsync(IRole, RequestOptions) Removes the specified role from this user in the guild. public Task RemoveRoleAsync(IRole role, RequestOptions options = null) Parameters role IRole The role to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveRoleAsync(ulong, RequestOptions) Removes the specified roleId from this user in the guild. public Task RemoveRoleAsync(ulong roleId, RequestOptions options = null) Parameters roleId ulong The role to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveRolesAsync(IEnumerable, RequestOptions) Removes the specified roles from this user in the guild. public Task RemoveRolesAsync(IEnumerable roles, RequestOptions options = null) Parameters roles IEnumerable The roles to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveRolesAsync(IEnumerable, RequestOptions) Removes the specified roleIds from this user in the guild. public Task RemoveRolesAsync(IEnumerable roleIds, RequestOptions options = null) Parameters roleIds IEnumerable The roles to be removed from the user. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous role removal operation. RemoveTimeOutAsync(RequestOptions) Removes the current timeout from the user in this guild if one exists. public Task RemoveTimeOutAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous timeout removal operation. SetTimeOutAsync(TimeSpan, RequestOptions) Sets a timeout based on provided TimeSpan to this user in the guild. public Task SetTimeOutAsync(TimeSpan span, RequestOptions options = null) Parameters span TimeSpan The TimeSpan indicating how long a user should be timed out for. options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous timeout creation operation. UpdateAsync(RequestOptions) Updates this object's properties with its current state. public override Task UpdateAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task" }, "api/Discord.Rest.RestGuildWidget.html": { "href": "api/Discord.Rest.RestGuildWidget.html", @@ -2942,7 +2942,7 @@ "api/Discord.Rest.RestSelfUser.html": { "href": "api/Discord.Rest.RestSelfUser.html", "title": "Class RestSelfUser | Discord.Net Documentation", - "keywords": "Class RestSelfUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents the logged-in REST-based user. public class RestSelfUser : RestUser, IUpdateable, ISelfUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence Inheritance object RestEntity RestUser RestSelfUser Implements IUpdateable ISelfUser IUser ISnowflakeEntity IEntity IMentionable IPresence Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.IsWebhook RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetDisplayAvatarUrl(ImageFormat, ushort) RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties Email Gets the email associated with this user. public string Email { get; } Property Value string Flags Gets the flags that are applied to a user's account. public UserProperties Flags { get; } Property Value UserProperties The value of flags for this user. Remarks This value is determined by bitwise OR-ing UserProperties values together. IsMfaEnabled Indicates whether or not this user has MFA enabled on their account. public bool IsMfaEnabled { get; } Property Value bool true if this user has enabled multi-factor authentication on their account; false if not. IsVerified Indicates whether or not this user has their email verified. public bool IsVerified { get; } Property Value bool true if this user's email has been verified; false if not. Locale Gets the user's chosen language option. public string Locale { get; } Property Value string The IETF language tag of the user's chosen region, if provided. For example, a locale of \"English, US\" is \"en-US\", \"Chinese (Taiwan)\" is \"zh-TW\", etc. PremiumType Gets the type of Nitro subscription that is active on this user's account. public PremiumType PremiumType { get; } Property Value PremiumType The type of Nitro subscription the user subscribes to, if any. Remarks This information may only be available with the identify OAuth scope. Methods ModifyAsync(Action, RequestOptions) Modifies the user's properties. public Task ModifyAsync(Action func, RequestOptions options = null) Parameters func Action options RequestOptions Returns Task Exceptions InvalidOperationException Unable to modify this object using a different token. UpdateAsync(RequestOptions) Updates this object's properties with its current state. public override Task UpdateAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task Exceptions InvalidOperationException Unable to update this object using a different token." + "keywords": "Class RestSelfUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents the logged-in REST-based user. public class RestSelfUser : RestUser, IUpdateable, ISelfUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence Inheritance object RestEntity RestUser RestSelfUser Implements IUpdateable ISelfUser IUser ISnowflakeEntity IEntity IMentionable IPresence Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.BannerColor RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.IsWebhook RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetDisplayAvatarUrl(ImageFormat, ushort) RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties Email Gets the email associated with this user. public string Email { get; } Property Value string Flags Gets the flags that are applied to a user's account. public UserProperties Flags { get; } Property Value UserProperties The value of flags for this user. Remarks This value is determined by bitwise OR-ing UserProperties values together. IsMfaEnabled Indicates whether or not this user has MFA enabled on their account. public bool IsMfaEnabled { get; } Property Value bool true if this user has enabled multi-factor authentication on their account; false if not. IsVerified Indicates whether or not this user has their email verified. public bool IsVerified { get; } Property Value bool true if this user's email has been verified; false if not. Locale Gets the user's chosen language option. public string Locale { get; } Property Value string The IETF language tag of the user's chosen region, if provided. For example, a locale of \"English, US\" is \"en-US\", \"Chinese (Taiwan)\" is \"zh-TW\", etc. PremiumType Gets the type of Nitro subscription that is active on this user's account. public PremiumType PremiumType { get; } Property Value PremiumType The type of Nitro subscription the user subscribes to, if any. Remarks This information may only be available with the identify OAuth scope. Methods ModifyAsync(Action, RequestOptions) Modifies the user's properties. public Task ModifyAsync(Action func, RequestOptions options = null) Parameters func Action options RequestOptions Returns Task Exceptions InvalidOperationException Unable to modify this object using a different token. UpdateAsync(RequestOptions) Updates this object's properties with its current state. public override Task UpdateAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task Exceptions InvalidOperationException Unable to update this object using a different token." }, "api/Discord.Rest.RestSlashCommand.html": { "href": "api/Discord.Rest.RestSlashCommand.html", @@ -2997,7 +2997,7 @@ "api/Discord.Rest.RestUser.html": { "href": "api/Discord.Rest.RestUser.html", "title": "Class RestUser | Discord.Net Documentation", - "keywords": "Class RestUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents a REST-based user. public class RestUser : RestEntity, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IUpdateable Inheritance object RestEntity RestUser Implements IUser ISnowflakeEntity IEntity IMentionable IPresence IUpdateable Derived RestGroupUser RestGuildUser RestSelfUser RestWebhookUser Inherited Members RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties AccentColor public Color? AccentColor { get; } Property Value Color? ActiveClients Gets the set of clients where this user is currently active. public virtual IReadOnlyCollection ActiveClients { get; } Property Value IReadOnlyCollection Activities Gets the list of activities that this user currently has available. public virtual IReadOnlyCollection Activities { get; } Property Value IReadOnlyCollection Activity public virtual IActivity Activity { get; } Property Value IActivity AvatarDecorationHash Gets the hash of the avatar decoration. public string AvatarDecorationHash { get; } Property Value string Remarks null if the user has no avatar decoration set. AvatarDecorationSkuId Gets the id of the avatar decoration's SKU. public ulong? AvatarDecorationSkuId { get; } Property Value ulong? Remarks null if the user has no avatar decoration set. AvatarId Gets the identifier of this user's avatar. public string AvatarId { get; } Property Value string BannerId public string BannerId { get; } Property Value string CreatedAt Gets when the snowflake was created. public DateTimeOffset CreatedAt { get; } Property Value DateTimeOffset A DateTimeOffset representing when the entity was first created. Discriminator Gets the per-username unique ID for this user. This will return \"0000\" for users who have migrated to new username system. public string Discriminator { get; } Property Value string DiscriminatorValue Gets the per-username unique ID for this user. This will return 0 for users who have migrated to new username system. public ushort DiscriminatorValue { get; } Property Value ushort GlobalName Gets the user's display name, if it is set. For bots, this will get the application name. public string GlobalName { get; } Property Value string Remarks This property will be null if user has no display name set. IsBot Gets a value that indicates whether this user is identified as a bot. public bool IsBot { get; } Property Value bool true if the user is a bot application; otherwise false. Remarks This property retrieves a value that indicates whether this user is a registered bot application (indicated by the blue BOT tag within the official chat client). IsWebhook Gets a value that indicates whether this user is a webhook user. public virtual bool IsWebhook { get; } Property Value bool true if the user is a webhook; otherwise false. Mention Returns a special string used to mention this object. public string Mention { get; } Property Value string A string that is recognized by Discord as a mention (e.g. <@168693960628371456>). PublicFlags Gets the public flags that are applied to this user's account. public UserProperties? PublicFlags { get; } Property Value UserProperties? The value of public flags for this user. Remarks This value is determined by bitwise OR-ing UserProperties values together. Status Gets the current status of this user. public virtual UserStatus Status { get; } Property Value UserStatus Username Gets the username for this user. public string Username { get; } Property Value string Methods CreateDMChannelAsync(RequestOptions) Creates a direct message channel to this user. public Task CreateDMChannelAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous get operation. The task result contains a rest DM channel where the user is the recipient. GetAvatarDecorationUrl() Gets the URL for user's avatar decoration. public string GetAvatarDecorationUrl() Returns string Remarks null if the user has no avatar decoration set. GetAvatarUrl(ImageFormat, ushort) Gets the avatar URL for this user, if it is set. public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's avatar URL; null if the user has no avatar set. Examples The following example attempts to retrieve the user's current avatar and send it to a channel; if one is not set, a default avatar for this user will be returned instead. Remarks tip If you wish to retrieve the display avatar for this user, consider using GetDisplayAvatarUrl(ImageFormat, ushort). GetBannerUrl(ImageFormat, ushort) public string GetBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 256) Parameters format ImageFormat size ushort Returns string GetDefaultAvatarUrl() Gets the default avatar URL for this user. public string GetDefaultAvatarUrl() Returns string A string representing the user's default avatar URL. Remarks This avatar is auto-generated by Discord and consists of their logo combined with a random background color. note The calculation is always done by taking the remainder of this user's DiscriminatorValue divided by 5. GetDisplayAvatarUrl(ImageFormat, ushort) Gets the display avatar URL for this user. public virtual string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's display avatar URL. Remarks This method will return GetDefaultAvatarUrl() if the user has no avatar set. ToString() Gets the Username#Discriminator of the user. public override string ToString() Returns string A string that resolves to Username#Discriminator of the user. UpdateAsync(RequestOptions) Updates this object's properties with its current state. public virtual Task UpdateAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task" + "keywords": "Class RestUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll Represents a REST-based user. public class RestUser : RestEntity, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IUpdateable Inheritance object RestEntity RestUser Implements IUser ISnowflakeEntity IEntity IMentionable IPresence IUpdateable Derived RestGroupUser RestGuildUser RestSelfUser RestWebhookUser Inherited Members RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties AccentColor public Color? AccentColor { get; } Property Value Color? ActiveClients Gets the set of clients where this user is currently active. public virtual IReadOnlyCollection ActiveClients { get; } Property Value IReadOnlyCollection Activities Gets the list of activities that this user currently has available. public virtual IReadOnlyCollection Activities { get; } Property Value IReadOnlyCollection Activity public virtual IActivity Activity { get; } Property Value IActivity AvatarDecorationHash Gets the hash of the avatar decoration. public string AvatarDecorationHash { get; } Property Value string Remarks null if the user has no avatar decoration set. AvatarDecorationSkuId Gets the id of the avatar decoration's SKU. public ulong? AvatarDecorationSkuId { get; } Property Value ulong? Remarks null if the user has no avatar decoration set. AvatarId Gets the identifier of this user's avatar. public string AvatarId { get; } Property Value string BannerColor Gets the color of the banner. public Color? BannerColor { get; } Property Value Color? Remarks null if the user has no banner set. BannerId Gets the hash of the banner. public string BannerId { get; } Property Value string Remarks null if the user has no banner set. CreatedAt Gets when the snowflake was created. public DateTimeOffset CreatedAt { get; } Property Value DateTimeOffset A DateTimeOffset representing when the entity was first created. Discriminator Gets the per-username unique ID for this user. This will return \"0000\" for users who have migrated to new username system. public string Discriminator { get; } Property Value string DiscriminatorValue Gets the per-username unique ID for this user. This will return 0 for users who have migrated to new username system. public ushort DiscriminatorValue { get; } Property Value ushort GlobalName Gets the user's display name, if it is set. For bots, this will get the application name. public string GlobalName { get; } Property Value string Remarks This property will be null if user has no display name set. IsBot Gets a value that indicates whether this user is identified as a bot. public bool IsBot { get; } Property Value bool true if the user is a bot application; otherwise false. Remarks This property retrieves a value that indicates whether this user is a registered bot application (indicated by the blue BOT tag within the official chat client). IsWebhook Gets a value that indicates whether this user is a webhook user. public virtual bool IsWebhook { get; } Property Value bool true if the user is a webhook; otherwise false. Mention Returns a special string used to mention this object. public string Mention { get; } Property Value string A string that is recognized by Discord as a mention (e.g. <@168693960628371456>). PublicFlags Gets the public flags that are applied to this user's account. public UserProperties? PublicFlags { get; } Property Value UserProperties? The value of public flags for this user. Remarks This value is determined by bitwise OR-ing UserProperties values together. Status Gets the current status of this user. public virtual UserStatus Status { get; } Property Value UserStatus Username Gets the username for this user. public string Username { get; } Property Value string Methods CreateDMChannelAsync(RequestOptions) Creates a direct message channel to this user. public Task CreateDMChannelAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task A task that represents the asynchronous get operation. The task result contains a rest DM channel where the user is the recipient. GetAvatarDecorationUrl() Gets the URL for user's avatar decoration. public string GetAvatarDecorationUrl() Returns string Remarks null if the user has no avatar decoration set. GetAvatarUrl(ImageFormat, ushort) Gets the avatar URL for this user, if it is set. public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's avatar URL; null if the user has no avatar set. Examples The following example attempts to retrieve the user's current avatar and send it to a channel; if one is not set, a default avatar for this user will be returned instead. Remarks tip If you wish to retrieve the display avatar for this user, consider using GetDisplayAvatarUrl(ImageFormat, ushort). GetBannerUrl(ImageFormat, ushort) public string GetBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 256) Parameters format ImageFormat size ushort Returns string GetDefaultAvatarUrl() Gets the default avatar URL for this user. public string GetDefaultAvatarUrl() Returns string A string representing the user's default avatar URL. Remarks This avatar is auto-generated by Discord and consists of their logo combined with a random background color. note The calculation is always done by taking the remainder of this user's DiscriminatorValue divided by 5. GetDisplayAvatarUrl(ImageFormat, ushort) Gets the display avatar URL for this user. public virtual string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) Parameters format ImageFormat The format of the image. size ushort The size of the image that matches any power of two, ranging from 16 to 2048. Returns string A string representing the user's display avatar URL. Remarks This method will return GetDefaultAvatarUrl() if the user has no avatar set. ToString() Gets the Username#Discriminator of the user. public override string ToString() Returns string A string that resolves to Username#Discriminator of the user. UpdateAsync(RequestOptions) Updates this object's properties with its current state. public virtual Task UpdateAsync(RequestOptions options = null) Parameters options RequestOptions The options to be used when sending the request. Returns Task" }, "api/Discord.Rest.RestUserCommand.html": { "href": "api/Discord.Rest.RestUserCommand.html", @@ -3037,7 +3037,7 @@ "api/Discord.Rest.RestWebhookUser.html": { "href": "api/Discord.Rest.RestWebhookUser.html", "title": "Class RestWebhookUser | Discord.Net Documentation", - "keywords": "Class RestWebhookUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll public class RestWebhookUser : RestUser, IUpdateable, IWebhookUser, IGuildUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IVoiceState Inheritance object RestEntity RestUser RestWebhookUser Implements IUpdateable IWebhookUser IGuildUser IUser ISnowflakeEntity IEntity IMentionable IPresence IVoiceState Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.UpdateAsync(RequestOptions) RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetDisplayAvatarUrl(ImageFormat, ushort) RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.BanAsync(IGuildUser, int, string, RequestOptions) UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties GuildId Gets the ID of the guild for this user. public ulong GuildId { get; } Property Value ulong An ulong representing the snowflake identifier of the guild that this user belongs to. IsWebhook Gets a value that indicates whether this user is a webhook user. public override bool IsWebhook { get; } Property Value bool true if the user is a webhook; otherwise false. PremiumSince Gets the date and time for when this user's guild boost began. public DateTimeOffset? PremiumSince { get; } Property Value DateTimeOffset? A DateTimeOffset for when the user began boosting this guild; null if they are not boosting the guild. WebhookId Gets the ID of a webhook. public ulong WebhookId { get; } Property Value ulong" + "keywords": "Class RestWebhookUser Namespace Discord.Rest Assembly Discord.Net.Rest.dll public class RestWebhookUser : RestUser, IUpdateable, IWebhookUser, IGuildUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence, IVoiceState Inheritance object RestEntity RestUser RestWebhookUser Implements IUpdateable IWebhookUser IGuildUser IUser ISnowflakeEntity IEntity IMentionable IPresence IVoiceState Inherited Members RestUser.IsBot RestUser.Username RestUser.DiscriminatorValue RestUser.AvatarId RestUser.BannerId RestUser.BannerColor RestUser.AccentColor RestUser.PublicFlags RestUser.GlobalName RestUser.CreatedAt RestUser.Discriminator RestUser.Mention RestUser.Activity RestUser.Status RestUser.ActiveClients RestUser.Activities RestUser.AvatarDecorationHash RestUser.AvatarDecorationSkuId RestUser.UpdateAsync(RequestOptions) RestUser.CreateDMChannelAsync(RequestOptions) RestUser.GetAvatarUrl(ImageFormat, ushort) RestUser.GetBannerUrl(ImageFormat, ushort) RestUser.GetDefaultAvatarUrl() RestUser.GetDisplayAvatarUrl(ImageFormat, ushort) RestUser.GetAvatarDecorationUrl() RestUser.ToString() RestEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.BanAsync(IGuildUser, int, string, RequestOptions) UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties GuildId Gets the ID of the guild for this user. public ulong GuildId { get; } Property Value ulong An ulong representing the snowflake identifier of the guild that this user belongs to. IsWebhook Gets a value that indicates whether this user is a webhook user. public override bool IsWebhook { get; } Property Value bool true if the user is a webhook; otherwise false. PremiumSince Gets the date and time for when this user's guild boost began. public DateTimeOffset? PremiumSince { get; } Property Value DateTimeOffset? A DateTimeOffset for when the user began boosting this guild; null if they are not boosting the guild. WebhookId Gets the ID of a webhook. public ulong WebhookId { get; } Property Value ulong" }, "api/Discord.Rest.RoleCreateAuditLogData.html": { "href": "api/Discord.Rest.RoleCreateAuditLogData.html", @@ -3292,7 +3292,7 @@ "api/Discord.SelfUserProperties.html": { "href": "api/Discord.SelfUserProperties.html", "title": "Class SelfUserProperties | Discord.Net Documentation", - "keywords": "Class SelfUserProperties Namespace Discord Assembly Discord.Net.Core.dll Properties that are used to modify the ISelfUser with the specified changes. public class SelfUserProperties Inheritance object SelfUserProperties Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Examples The following example uses ModifyAsync to apply changes specified in the properties, await selfUser.ModifyAsync(x => { x.Username = \"Mercy\"; }); Properties Avatar Gets or sets the avatar. public Optional Avatar { get; set; } Property Value Optional Username Gets or sets the username. public Optional Username { get; set; } Property Value Optional See Also ModifyAsync(Action, RequestOptions)" + "keywords": "Class SelfUserProperties Namespace Discord Assembly Discord.Net.Core.dll Properties that are used to modify the ISelfUser with the specified changes. public class SelfUserProperties Inheritance object SelfUserProperties Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Examples The following example uses ModifyAsync to apply changes specified in the properties, await selfUser.ModifyAsync(x => { x.Username = \"Mercy\"; }); Properties Avatar Gets or sets the avatar. public Optional Avatar { get; set; } Property Value Optional Banner Gets or sets the banner. public Optional Banner { get; set; } Property Value Optional Username Gets or sets the username. public Optional Username { get; set; } Property Value Optional See Also ModifyAsync(Action, RequestOptions)" }, "api/Discord.SessionStartLimit.html": { "href": "api/Discord.SessionStartLimit.html", @@ -4027,7 +4027,7 @@ "api/Discord.WebSocket.SocketSelfUser.html": { "href": "api/Discord.WebSocket.SocketSelfUser.html", "title": "Class SocketSelfUser | Discord.Net Documentation", - "keywords": "Class SocketSelfUser Namespace Discord.WebSocket Assembly Discord.Net.WebSocket.dll Represents the logged-in WebSocket-based user. public class SocketSelfUser : SocketUser, ISelfUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence Inheritance object SocketEntity SocketUser SocketSelfUser Implements ISelfUser IUser ISnowflakeEntity IEntity IMentionable IPresence Inherited Members SocketUser.PublicFlags SocketUser.CreatedAt SocketUser.Discriminator SocketUser.Mention SocketUser.Status SocketUser.ActiveClients SocketUser.Activities SocketUser.AvatarDecorationHash SocketUser.AvatarDecorationSkuId SocketUser.MutualGuilds SocketUser.CreateDMChannelAsync(RequestOptions) SocketUser.GetAvatarUrl(ImageFormat, ushort) SocketUser.GetDefaultAvatarUrl() SocketUser.GetDisplayAvatarUrl(ImageFormat, ushort) SocketUser.GetAvatarDecorationUrl() SocketUser.ToString() SocketEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties AvatarId Gets the identifier of this user's avatar. public override string AvatarId { get; } Property Value string DiscriminatorValue Gets the per-username unique ID for this user. This will return 0 for users who have migrated to new username system. public override ushort DiscriminatorValue { get; } Property Value ushort Email Gets the email associated with this user. public string Email { get; } Property Value string Flags Gets the flags that are applied to a user's account. public UserProperties Flags { get; } Property Value UserProperties The value of flags for this user. Remarks This value is determined by bitwise OR-ing UserProperties values together. GlobalName Gets the user's display name, if it is set. For bots, this will get the application name. public override string GlobalName { get; } Property Value string Remarks This property will be null if user has no display name set. IsBot Gets a value that indicates whether this user is identified as a bot. public override bool IsBot { get; } Property Value bool true if the user is a bot application; otherwise false. Remarks This property retrieves a value that indicates whether this user is a registered bot application (indicated by the blue BOT tag within the official chat client). IsMfaEnabled Indicates whether or not this user has MFA enabled on their account. public bool IsMfaEnabled { get; } Property Value bool true if this user has enabled multi-factor authentication on their account; false if not. IsVerified Indicates whether or not this user has their email verified. public bool IsVerified { get; } Property Value bool true if this user's email has been verified; false if not. IsWebhook Gets a value that indicates whether this user is a webhook user. public override bool IsWebhook { get; } Property Value bool true if the user is a webhook; otherwise false. Locale Gets the user's chosen language option. public string Locale { get; } Property Value string The IETF language tag of the user's chosen region, if provided. For example, a locale of \"English, US\" is \"en-US\", \"Chinese (Taiwan)\" is \"zh-TW\", etc. PremiumType Gets the type of Nitro subscription that is active on this user's account. public PremiumType PremiumType { get; } Property Value PremiumType The type of Nitro subscription the user subscribes to, if any. Remarks This information may only be available with the identify OAuth scope. Username Gets the username for this user. public override string Username { get; } Property Value string Methods ModifyAsync(Action, RequestOptions) Modifies the user's properties. public Task ModifyAsync(Action func, RequestOptions options = null) Parameters func Action options RequestOptions Returns Task" + "keywords": "Class SocketSelfUser Namespace Discord.WebSocket Assembly Discord.Net.WebSocket.dll Represents the logged-in WebSocket-based user. public class SocketSelfUser : SocketUser, ISelfUser, IUser, ISnowflakeEntity, IEntity, IMentionable, IPresence Inheritance object SocketEntity SocketUser SocketSelfUser Implements ISelfUser IUser ISnowflakeEntity IEntity IMentionable IPresence Inherited Members SocketUser.PublicFlags SocketUser.CreatedAt SocketUser.Discriminator SocketUser.Mention SocketUser.Status SocketUser.ActiveClients SocketUser.Activities SocketUser.AvatarDecorationHash SocketUser.AvatarDecorationSkuId SocketUser.MutualGuilds SocketUser.CreateDMChannelAsync(RequestOptions) SocketUser.GetAvatarUrl(ImageFormat, ushort) SocketUser.GetDefaultAvatarUrl() SocketUser.GetDisplayAvatarUrl(ImageFormat, ushort) SocketUser.GetAvatarDecorationUrl() SocketUser.ToString() SocketEntity.Id object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) Extension Methods UserExtensions.SendFileAsync(IUser, FileAttachment, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, Stream, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFileAsync(IUser, string, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendFilesAsync(IUser, IEnumerable, string, bool, Embed, RequestOptions, MessageComponent, Embed[]) UserExtensions.SendMessageAsync(IUser, string, bool, Embed, RequestOptions, AllowedMentions, MessageComponent, Embed[]) Properties AvatarId Gets the identifier of this user's avatar. public override string AvatarId { get; } Property Value string BannerColor Gets the color of the banner. public Color? BannerColor { get; } Property Value Color? Remarks null if the user has no banner set. BannerId Gets the hash of the banner. public string BannerId { get; } Property Value string Remarks null if the user has no banner set. DiscriminatorValue Gets the per-username unique ID for this user. This will return 0 for users who have migrated to new username system. public override ushort DiscriminatorValue { get; } Property Value ushort Email Gets the email associated with this user. public string Email { get; } Property Value string Flags Gets the flags that are applied to a user's account. public UserProperties Flags { get; } Property Value UserProperties The value of flags for this user. Remarks This value is determined by bitwise OR-ing UserProperties values together. GlobalName Gets the user's display name, if it is set. For bots, this will get the application name. public override string GlobalName { get; } Property Value string Remarks This property will be null if user has no display name set. IsBot Gets a value that indicates whether this user is identified as a bot. public override bool IsBot { get; } Property Value bool true if the user is a bot application; otherwise false. Remarks This property retrieves a value that indicates whether this user is a registered bot application (indicated by the blue BOT tag within the official chat client). IsMfaEnabled Indicates whether or not this user has MFA enabled on their account. public bool IsMfaEnabled { get; } Property Value bool true if this user has enabled multi-factor authentication on their account; false if not. IsVerified Indicates whether or not this user has their email verified. public bool IsVerified { get; } Property Value bool true if this user's email has been verified; false if not. IsWebhook Gets a value that indicates whether this user is a webhook user. public override bool IsWebhook { get; } Property Value bool true if the user is a webhook; otherwise false. Locale Gets the user's chosen language option. public string Locale { get; } Property Value string The IETF language tag of the user's chosen region, if provided. For example, a locale of \"English, US\" is \"en-US\", \"Chinese (Taiwan)\" is \"zh-TW\", etc. PremiumType Gets the type of Nitro subscription that is active on this user's account. public PremiumType PremiumType { get; } Property Value PremiumType The type of Nitro subscription the user subscribes to, if any. Remarks This information may only be available with the identify OAuth scope. Username Gets the username for this user. public override string Username { get; } Property Value string Methods ModifyAsync(Action, RequestOptions) Modifies the user's properties. public Task ModifyAsync(Action func, RequestOptions options = null) Parameters func Action options RequestOptions Returns Task" }, "api/Discord.WebSocket.SocketSlashCommand.html": { "href": "api/Discord.WebSocket.SocketSlashCommand.html", @@ -4537,7 +4537,7 @@ "guides/int_framework/intro.html": { "href": "guides/int_framework/intro.html", "title": "Introduction to the Interaction Service | Discord.Net Documentation", - "keywords": "Getting Started The Interaction Service provides an attribute based framework for creating Discord Interaction handlers. To start using the Interaction Service, you need to create a service instance. Optionally you can provide the InteractionService constructor with a InteractionServiceConfig to change the services behaviour to suit your needs. ... // _client here is DiscordSocketClient. // A different approach to passing in a restclient is also possible. var _interactionService = new InteractionService(_client.Rest); ... Modules Attribute based Interaction handlers must be defined within a command module class. Command modules are responsible for executing the Interaction handlers and providing them with the necessary execution info and helper functions. Command modules are transient objects. A new module instance is created before a command execution starts then it will be disposed right after the method returns. Every module class must: be public inherit InteractionModuleBase Optionally you can override the included : OnModuleBuilding (executed after the module is built) BeforeExecute (executed before a command execution starts) AfterExecute (executed after a command execution concludes) methods to configure the modules behaviour. Every command module exposes a set of helper methods, namely: RespondAsync() => Respond to the interaction FollowupAsync() => Create a followup message for an interaction ReplyAsync() => Send a message to the origin channel of the interaction DeleteOriginalResponseAsync() => Delete the original interaction response Commands Valid Interaction Commands must comply with the following requirements: return type max parameter count allowed parameter types attribute Slash Command Task/Task 25 any* [SlashCommand] User Command Task/Task 1 Implementations of IUser [UserCommand] Message Command Task/Task 1 Implementations of IMessage [MessageCommand] Component Interaction Command Task/Task inf string or string[] [ComponentInteraction] Autocomplete Command Task/Task - - [AutocompleteCommand] Note a TypeConverter that is capable of parsing type in question must be registered to the InteractionService instance. You should avoid using long running code in your command module. Depending on your setup, long running code may block the Gateway thread of your bot, interrupting its connection to Discord. Slash Commands Slash Commands are created using the SlashCommandAttribute. Every Slash Command must declare a name and a description. You can check Discords Application Command Naming Guidelines here. [SlashCommand(\"echo\", \"Echo an input\")] public async Task Echo(string input) { await RespondAsync(input); } Parameters Slash Commands can have up to 25 method parameters. You must name your parameters in accordance with Discords Naming Guidelines. InteractionService also features a pascal casing seperator for formatting parameter names with pascal casing into Discord compliant parameter names('parameterName' => 'parameter-name'). By default, your methods can feature the following parameter types: Implementations of IUser Implementations of IChannel Implementations of IRole Implementations of IMentionable Implementations of [IAttachment] string float, double, decimal bool char sbyte, byte int16, int32, int64 uint16, uint32, uint64 enum (Values are registered as multiple choice options and are enforced by Discord. Use the [Hide] attribute on enum values to prevent them from getting registered.) DateTime TimeSpan *You can use more specialized implementations of IChannel to restrict the allowed channel types for a channel type option. | interface | Channel Type | |---------------------|-------------------------------| | IStageChannel | Stage Channels | | IVoiceChannel | Voice Channels | | IDMChannel | DM Channels | | IGroupChannel | Group Channels | | ICategoryChannel | Category Channels | | INewsChannel | News Channels | | IThreadChannel | Public, Private, News Threads | | ITextChannel | Text Channels | Optional Parameters Parameters with default values (ie. int count = 0) will be displayed as optional parameters on Discord Client. Parameter Summary By using the SummaryAttribute you can customize the displayed name and description of a parameter [Summary(description: \"this is a parameter description\")] string input Parameter Choices ChoiceAttribute can be used to add choices to a parameter. [SlashCommand(\"blep\", \"Send a random adorable animal photo\")] public async Task Blep([Choice(\"Dog\", \"dog\"), Choice(\"Cat\", \"cat\"), Choice(\"Guinea pig\", \"GuineaPig\")] string animal) { ... } // In most cases, you can use an enum to replace the separate choice attributes in a command. public enum Animal { Cat, Dog, // You can also use the ChoiceDisplay attribute to change how they appear in the choice menu. [ChoiceDisplay(\"Guinea pig\")] GuineaPig } [SlashCommand(\"blep\", \"Send a random adorable animal photo\")] public async Task Blep(Animal animal) { ... } ``` This Slash Command will be displayed exactly the same as the previous example. Channel Types Channel types for an IChannel parameter can also be restricted using the ChannelTypesAttribute. [SlashCommand(\"name\", \"Description\")] public async Task Command([ChannelTypes(ChannelType.Stage, ChannelType.Text)] IChannel channel) { ... } In this case, user can only input Stage Channels and Text Channels to this parameter. Min/Max Value You can specify the permitted max/min value for a number type parameter using the MaxValueAttribute and MinValueAttribute. Complex Parameters This allows users to create slash command options using an object's constructor allowing complex objects to be created which cannot be infered from only one input value. Constructor methods support every attribute type that can be used with the regular slash commands ([Autocomplete], [Summary] etc. ). Preferred constructor of a Type can be specified either by passing a Type[] to the [ComplexParameterAttribute] or tagging a type constructor with the [ComplexParameterCtorAttribute]. If nothing is specified, the InteractionService defaults to the only public constructor of the type. TypeConverter pattern is used to parse the constructor methods objects. public class Vector3 { public int X {get;} public int Y {get;} public int Z {get;} public Vector3() { X = 0; Y = 0; Z = 0; } [ComplexParameterCtor] public Vector3(int x, int y, int z) { X = x; Y = y; Z = z; } } // Both of the commands below are displayed to the users identically. // With complex parameter [SlashCommand(\"create-vector\", \"Create a 3D vector.\")] public async Task CreateVector([ComplexParameter]Vector3 vector3) { ... } // Without complex parameter [SlashCommand(\"create-vector\", \"Create a 3D vector.\")] public async Task CreateVector(int x, int y, int z) { ... } Interaction service complex parameter constructors are prioritized in the following order: Constructor matching the signature provided in the [ComplexParameter(Type[])] overload. Constuctor tagged with [ComplexParameterCtor]. Type's only public constuctor. DM Permissions You can use the [EnabledInDmAttribute] to configure whether a globally-scoped top level command should be enabled in Dms or not. Only works on top level commands. Default Member Permissions [DefaultMemberPermissionsAttribute] can be used when creating a command to set the permissions a user must have to use the command. Permission overwrites can be configured from the Integrations page of Guild Settings. [DefaultMemberPermissionsAttribute] cumulatively propagates down the class hierarchy until it reaches a top level command. This attribute can be only used on top level commands and will not work on commands that are nested in command groups. User Commands A valid User Command must have the following structure: [UserCommand(\"Say Hello\")] public async Task SayHello(IUser user) { ... } Warning User commands can only have one parameter and its type must be an implementation of IUser. Message Commands A valid Message Command must have the following structure: [MessageCommand(\"Bookmark\")] public async Task Bookmark(IMessage msg) { ... } Warning Message commands can only have one parameter and its type must be an implementation of IMessage. Component Interaction Commands Component Interaction Commands are used to handle interactions that originate from Discord Message Components. This pattern is particularly useful if you will be reusing a set a Custom IDs. Component Interaction Commands support wild card matching, by default * character can be used to create a wild card pattern. Interaction Service will use lazy matching to capture the words corresponding to the wild card character. And the captured words will be passed on to the command method in the same order they were captured. [ComponentInteraction(\"player:*,*\")] public async Task Play(string op, string name) { ... } You may use as many wild card characters as you want. Note If Interaction Service receives a component interaction with player:play,rickroll custom id, op will be play and name will be rickroll Select Menus Unlike button interactions, select menu interactions also contain the values of the selected menu items. In this case, you should structure your method to accept a string array. Note Use arrays of IUser, IChannel, IRole, IMentionable or their implementations to get data from a select menu with respective type. [ComponentInteraction(\"role_selection\")] public async Task RoleSelection(string[] selectedRoles) { ... } [ComponentInteraction(\"role_selection_*\")] public async Task RoleSelection(string id, string[] selectedRoles) { ... } Note Wildcards may also be used to match a select menu ID, though keep in mind that the array containing the select menu values should be the last parameter. Autocomplete Commands Autocomplete commands must be parameterless methods. A valid Autocomplete command must have the following structure: [AutocompleteCommand(\"parameter_name\", \"command_name\")] public async Task Autocomplete() { string userInput = (Context.Interaction as SocketAutocompleteInteraction).Data.Current.Value.ToString(); IEnumerable results = new[] { new AutocompleteResult(\"foo\", \"foo_value\"), new AutocompleteResult(\"bar\", \"bar_value\"), new AutocompleteResult(\"baz\", \"baz_value\"), }.Where(x => x.Name.StartsWith(userInput, StringComparison.InvariantCultureIgnoreCase)); // only send suggestions that starts with user's input; use case insensitive matching // max - 25 suggestions at a time await (Context.Interaction as SocketAutocompleteInteraction).RespondAsync(results.Take(25)); } // you need to add `Autocomplete` attribute before parameter to add autocompletion to it [SlashCommand(\"command_name\", \"command_description\")] public async Task ExampleCommand([Summary(\"parameter_name\"), Autocomplete] string parameterWithAutocompletion) => await RespondAsync($\"Your choice: {parameterWithAutocompletion}\"); Alternatively, you can use the AutocompleteHandlers to simplify this workflow. Modals Modal commands last parameter must be an implementation of IModal. A Modal implementation would look like this: // Registers a command that will respond with a modal. [SlashCommand(\"food\", \"Tell us about your favorite food.\")] public async Task Command() => await Context.Interaction.RespondWithModalAsync(\"food_menu\"); // Defines the modal that will be sent. public class FoodModal : IModal { public string Title => \"Fav Food\"; // Strings with the ModalTextInput attribute will automatically become components. [InputLabel(\"What??\")] [ModalTextInput(\"food_name\", placeholder: \"Pizza\", maxLength: 20)] public string Food { get; set; } // Additional paremeters can be specified to further customize the input. // Parameters can be optional [RequiredInput(false)] [InputLabel(\"Why??\")] [ModalTextInput(\"food_reason\", TextInputStyle.Paragraph, \"Kuz it's tasty\", maxLength: 500)] public string Reason { get; set; } } // Responds to the modal. [ModalInteraction(\"food_menu\")] public async Task ModalResponse(FoodModal modal) { // Check if \"Why??\" field is populated string reason = string.IsNullOrWhiteSpace(modal.Reason) ? \".\" : $\" because {modal.Reason}\"; // Build the message to send. string message = \"hey @everyone, I just learned \" + $\"{Context.User.Mention}'s favorite food is \" + $\"{modal.Food}{reason}\"; // Specify the AllowedMentions so we don't actually ping everyone. AllowedMentions mentions = new(); mentions.AllowedTypes = AllowedMentionTypes.Users; // Respond to the modal. await RespondAsync(message, allowedMentions: mentions, ephemeral: true); } Note If you are using Modals in the interaction service it is highly recommended that you enable PreCompiledLambdas in your config to prevent performance issues. Interaction Context Every command module provides its commands with an execution context. This context property includes general information about the underlying interaction that triggered the command execution. The base command context. You can design your modules to work with different implementation types of [IInteractionContext]. To achieve this, make sure your module classes inherit from the generic variant of the InteractionModuleBase. Note Context type must be consistent throughout the project, or you will run into issues during runtime. The InteractionService ships with 4 different kinds of InteractionContext: InteractionContext]: A bare-bones execution context consisting of only implementation neutral interfaces SocketInteractionContext: An execution context for use with DiscordSocketClient. Socket entities are exposed in this context without the need of casting them. ShardedInteractionContext: [DiscordShardedClient] variant of the SocketInteractionContext RestInteractionContext: An execution context designed to be used with a DiscordRestClient and webhook based interactions pattern You can create custom Interaction Contexts by implementing the [IInteractionContext] interface. One problem with using the concrete type InteractionContexts is that you cannot access the information that is specific to different interaction types without casting. Concrete type interaction contexts are great for creating shared interaction modules but you can also use the generic variants of the built-in interaction contexts to create interaction specific interaction modules. [!INFO] Message component interactions have access to a special method called UpdateAsync() to update the body of the method the interaction originated from. Normally this wouldn't be accessible without casting the Context.Interaction. discordClient.ButtonExecuted += async (interaction) => { var ctx = new SocketInteractionContext(discordClient, interaction); await _interactionService.ExecuteCommandAsync(ctx, serviceProvider); }; public class MessageComponentModule : InteractionModuleBase> { [ComponentInteraction(\"custom_id\")] public async Task Command() { await Context.Interaction.UpdateAsync(...); } } Loading Modules InteractionService can automatically discover and load modules that inherit InteractionModuleBase from an Assembly. Call InteractionService.AddModulesAsync() to use this functionality. Note You can also manually add Interaction modules using the InteractionService.AddModuleAsync() method by providing the module type you want to load. Resolving Module Dependencies Module dependencies are resolved using the Constructor Injection and Property Injection patterns. Meaning, the constructor parameters and public settable properties of a module will be assigned using the IServiceProvider. For more information on dependency injection, read the DependencyInjection guides. Note On every command execution, if the 'AutoServiceScopes' option is enabled in the config , module dependencies are resolved using a new service scope which allows you to utilize scoped service instances, just like in Asp.Net. Including the precondition checks, every module method is executed using the same service scope and service scopes are disposed right after the AfterExecute method returns. This doesn't apply to methods other than ExecuteAsync(). Module Groups Module groups allow you to create sub-commands and sub-commands groups. By nesting commands inside a module that is tagged with GroupAttribute you can create prefixed commands. Warning Although creating nested module structures are allowed, you are not permitted to use more than 2 GroupAttribute's in module hierarchy. Note To not use the command group's name as a prefix for component or modal interaction's custom id set ignoreGroupNames parameter to true in classes with GroupAttribute However, you have to be careful to prevent overlapping ids of buttons and modals. // You can put commands in groups [Group(\"group-name\", \"Group description\")] public class CommandGroupModule : InteractionModuleBase { // This command will look like // group-name ping [SlashCommand(\"ping\", \"Get a pong\")] public async Task PongSubcommand() => await RespondAsync(\"Pong!\"); // And even in sub-command groups [Group(\"subcommand-group-name\", \"Subcommand group description\")] public class SubСommandGroupModule : InteractionModuleBase { // This command will look like // group-name subcommand-group-name echo [SlashCommand(\"echo\", \"Echo an input\")] public async Task EchoSubcommand(string input) => await RespondAsync(input, components: new ComponentBuilder().WithButton(\"Echo\", $\"echoButton_{input}\").Build()); // Component interaction with ignoreGroupNames set to true [ComponentInteraction(\"echoButton_*\", true)] public async Task EchoButton(string input) => await RespondAsync(input); } } Executing Commands Any of the following socket events can be used to execute commands: InteractionCreated ButtonExecuted SelectMenuExecuted AutocompleteExecuted UserCommandExecuted MessageCommandExecuted ModalExecuted These events will trigger for the specific type of interaction they inherit their name from. The InteractionCreated event will trigger for all. An example of executing a command from an event can be seen here: // Theres multiple ways to subscribe to the event, depending on your application. Please use the approach fit to your type of client. // DiscordSocketClient: _socketClient.InteractionCreated += async (x) => { var ctx = new SocketInteractionContext(_socketClient, x); await _interactionService.ExecuteCommandAsync(ctx, _serviceProvider); } // DiscordShardedClient: _shardedClient.InteractionCreated += async (x) => { var ctx = new ShardedInteractionContext(_shardedClient, x); await _interactionService.ExecuteCommandAsync(ctx, _serviceProvider); } Commands can be either executed on the gateway thread or on a separate thread from the thread pool. This behaviour can be configured by changing the RunMode property of InteractionServiceConfig or by setting the runMode parameter of a command attribute. Warning In the example above, no form of post-execution is presented. Please carefully read the [Post Execution Documentation] for the best approach in resolving the result based on your RunMode. You can also configure the way InteractionService executes the commands. By default, commands are executed using ConstructorInfo.Invoke() to create module instances and MethodInfo.Invoke() method for executing the method bodies. By setting, InteractionServiceConfig.UseCompiledLambda to true, you can make InteractionService create module instances and execute commands using Compiled Lambda expressions. This cuts down on command execution time but it might add some memory overhead. Time it takes to create a module instance and execute a Task.Delay(0) method using the Reflection methods compared to Compiled Lambda expressions: Method Mean Error StdDev ReflectionInvoke 225.93 ns 4.522 ns 7.040 ns CompiledLambda 48.79 ns 0.981 ns 1.276 ns Registering Commands to Discord Application commands loaded to the Interaction Service can be registered to Discord using a number of different methods. In most cases RegisterCommandsGloballyAsync() and RegisterCommandsToGuildAsync() are the methods to use. Command registration methods can only be used after the gateway client is ready or the rest client is logged in. #if DEBUG await interactionService.RegisterCommandsToGuildAsync(); #else await interactionService.RegisterCommandsGloballyAsync(); #endif Methods like AddModulesToGuildAsync(), AddCommandsToGuildAsync(), AddModulesGloballyAsync() and AddCommandsGloballyAsync() can be used to register cherry picked modules or commands to global/guild scopes. Note DontAutoRegisterAttribute can be used on module classes to prevent RegisterCommandsGloballyAsync() and RegisterCommandsToGuildAsync() from registering them to the Discord. Interaction Utility Interaction Service ships with a static InteractionUtility class which contains some helper methods to asynchronously waiting for Discord Interactions. For instance, WaitForInteractionAsync() method allows you to wait for an Interaction for a given amount of time. This method returns the first encountered Interaction that satisfies the provided predicate. Warning If you are running the Interaction Service on RunMode.Sync you should avoid using this method in your commands, as it will block the gateway thread and interrupt your bots connection. Webhook Based Interactions Instead of using the gateway to receive Discord Interactions, Discord allows you to receive Interaction events over Webhooks. Interaction Service also supports this Interaction type but to be able to respond to the Interactions within your command modules you need to perform the following: Make your modules inherit RestInteractionModuleBase Set the ResponseCallback property of InteractionServiceConfig so that the ResponseCallback delegate can be used to create HTTP responses from a deserialized json object string. Use the interaction endpoints of the module base instead of the interaction object (ie. RespondAsync(), FollowupAsync()...). Localization Discord Slash Commands support name/description localization. Localization is available for names and descriptions of Slash Command Groups (GroupAttribute), Slash Commands (SlashCommandAttribute), Slash Command parameters and Slash Command Parameter Choices. Interaction Service can be initialized with an ILocalizationManager instance in its config which is used to create the necessary localization dictionaries on command registration. Interaction Service has two built-in ILocalizationManager implementations: ResxLocalizationManager and JsonLocalizationManager. ResXLocalizationManager ResxLocalizationManager uses . delimited key names to traverse the resource files and get the localized strings (group1.group2.command.parameter.name). A ResxLocalizationManager instance must be initialized with a base resource name, a target assembly and a collection of CultureInfos. Every key path must end with either .name or .description, including parameter choice strings. Discord.Tools.LocalizationTemplate.Resx dotnet tool can be used to create localization file templates. JsonLocalizationManager JsonLocalizationManager uses a nested data structure similar to Discord's Application Commands schema. You can get the Json schema here. JsonLocalizationManager accepts a base path and a base file name and automatically discovers every resource file ( \\basePath\\fileName.locale.json ). A Json resource file should have a structure similar to: { \"command_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\", \"parameter_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\" } }, \"group_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\", \"command_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\", \"parameter_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\" }, \"parameter_2\":{ \"name\": \"localized_name\", \"description\": \"localized_description\" } } } }" + "keywords": "Getting Started The Interaction Service provides an attribute based framework for creating Discord Interaction handlers. To start using the Interaction Service, you need to create a service instance. Optionally you can provide the InteractionService constructor with a InteractionServiceConfig to change the services behaviour to suit your needs. ... // _client here is DiscordSocketClient. // A different approach to passing in a restclient is also possible. var _interactionService = new InteractionService(_client.Rest); ... Modules Attribute based Interaction handlers must be defined within a command module class. Command modules are responsible for executing the Interaction handlers and providing them with the necessary execution info and helper functions. Command modules are transient objects. A new module instance is created before a command execution starts then it will be disposed right after the method returns. Every module class must: Be public Inherit from InteractionModuleBase Optionally you can override the included : OnModuleBuilding (executed after the module is built) BeforeExecute (executed before a command execution starts) AfterExecute (executed after a command execution concludes) methods to configure the modules behaviour. Every command module exposes a set of helper methods, namely: RespondAsync() => Respond to the interaction FollowupAsync() => Create a followup message for an interaction ReplyAsync() => Send a message to the origin channel of the interaction DeleteOriginalResponseAsync() => Delete the original interaction response Commands Valid Interaction Commands must comply with the following requirements: return type max parameter count allowed parameter types attribute Slash Command Task/Task 25 any* [SlashCommand] User Command Task/Task 1 Implementations of IUser [UserCommand] Message Command Task/Task 1 Implementations of IMessage [MessageCommand] Component Interaction Command Task/Task inf string or string[] [ComponentInteraction] Autocomplete Command Task/Task - - [AutocompleteCommand] Note A TypeConverter that is capable of parsing type in question must be registered to the InteractionService instance. You should avoid using long running code in your command module. Depending on your setup, long running code may block the Gateway thread of your bot, interrupting its connection to Discord. Slash Commands Slash Commands are created using the SlashCommandAttribute. Every Slash Command must declare a name and a description. You can check Discords Application Command Naming Guidelines here. [SlashCommand(\"echo\", \"Echo an input\")] public async Task Echo(string input) { await RespondAsync(input); } Parameters Slash Commands can have up to 25 method parameters. You must name your parameters in accordance with Discords Naming Guidelines. InteractionService also features a pascal casing seperator for formatting parameter names with pascal casing into Discord compliant parameter names('parameterName' => 'parameter-name'). By default, your methods can feature the following parameter types: Implementations of IUser Implementations of IChannel Implementations of IRole Implementations of IMentionable Implementations of [IAttachment] string float, double, decimal bool char sbyte, byte int16, int32, int64 uint16, uint32, uint64 enum DateTime TimeSpan Note Enum values are registered as multiple choice options and are enforced by Discord. Use the [Hide] attribute on enum values to prevent them from getting registered. You can use more specialized implementations of IChannel to restrict the allowed channel types for a channel type option. interface Channel Type IStageChannel Stage Channels IVoiceChannel Voice Channels IDMChannel DM Channels IGroupChannel Group Channels ICategoryChannel Category Channels INewsChannel News Channels IThreadChannel Public, Private, News Threads ITextChannel Text Channels Optional Parameters Parameters with default values (ie. int count = 0) will be displayed as optional parameters on Discord Client. Parameter Summary By using the SummaryAttribute you can customize the displayed name and description of a parameter [Summary(description: \"this is a parameter description\")] string input Parameter Choices ChoiceAttribute can be used to add choices to a parameter. [SlashCommand(\"blep\", \"Send a random adorable animal photo\")] public async Task Blep([Choice(\"Dog\", \"dog\"), Choice(\"Cat\", \"cat\"), Choice(\"Guinea pig\", \"GuineaPig\")] string animal) { ... } // In most cases, you can use an enum to replace the separate choice attributes in a command. public enum Animal { Cat, Dog, // You can also use the ChoiceDisplay attribute to change how they appear in the choice menu. [ChoiceDisplay(\"Guinea pig\")] GuineaPig } [SlashCommand(\"blep\", \"Send a random adorable animal photo\")] public async Task Blep(Animal animal) { ... } ``` This Slash Command will be displayed exactly the same as the previous example. Channel Types Channel types for an IChannel parameter can also be restricted using the ChannelTypesAttribute. [SlashCommand(\"name\", \"Description\")] public async Task Command([ChannelTypes(ChannelType.Stage, ChannelType.Text)] IChannel channel) { ... } In this case, user can only input Stage Channels and Text Channels to this parameter. Min/Max Value You can specify the permitted max/min value for a number type parameter using the MaxValueAttribute and MinValueAttribute. Complex Parameters This allows users to create slash command options using an object's constructor allowing complex objects to be created which cannot be infered from only one input value. Constructor methods support every attribute type that can be used with the regular slash commands ([Autocomplete], [Summary] etc. ). Preferred constructor of a Type can be specified either by passing a Type[] to the [ComplexParameterAttribute] or tagging a type constructor with the [ComplexParameterCtorAttribute]. If nothing is specified, the InteractionService defaults to the only public constructor of the type. TypeConverter pattern is used to parse the constructor methods objects. public class Vector3 { public int X {get;} public int Y {get;} public int Z {get;} public Vector3() { X = 0; Y = 0; Z = 0; } [ComplexParameterCtor] public Vector3(int x, int y, int z) { X = x; Y = y; Z = z; } } // Both of the commands below are displayed to the users identically. // With complex parameter [SlashCommand(\"create-vector\", \"Create a 3D vector.\")] public async Task CreateVector([ComplexParameter]Vector3 vector3) { ... } // Without complex parameter [SlashCommand(\"create-vector\", \"Create a 3D vector.\")] public async Task CreateVector(int x, int y, int z) { ... } Interaction service complex parameter constructors are prioritized in the following order: Constructor matching the signature provided in the [ComplexParameter(Type[])] overload. Constuctor tagged with [ComplexParameterCtor]. Type's only public constuctor. DM Permissions You can use the [EnabledInDmAttribute] to configure whether a globally-scoped top level command should be enabled in Dms or not. Only works on top level commands. Default Member Permissions [DefaultMemberPermissionsAttribute] can be used when creating a command to set the permissions a user must have to use the command. Permission overwrites can be configured from the Integrations page of Guild Settings. [DefaultMemberPermissionsAttribute] cumulatively propagates down the class hierarchy until it reaches a top level command. This attribute can be only used on top level commands and will not work on commands that are nested in command groups. User Commands A valid User Command must have the following structure: [UserCommand(\"Say Hello\")] public async Task SayHello(IUser user) { ... } Warning User commands can only have one parameter and its type must be an implementation of IUser. Message Commands A valid Message Command must have the following structure: [MessageCommand(\"Bookmark\")] public async Task Bookmark(IMessage msg) { ... } Warning Message commands can only have one parameter and its type must be an implementation of IMessage. Component Interaction Commands Component Interaction Commands are used to handle interactions that originate from Discord Message Components. This pattern is particularly useful if you will be reusing a set a Custom IDs. Component Interaction Commands support wild card matching, by default * character can be used to create a wild card pattern. Interaction Service will use lazy matching to capture the words corresponding to the wild card character. And the captured words will be passed on to the command method in the same order they were captured. [ComponentInteraction(\"player:*,*\")] public async Task Play(string op, string name) { ... } You may use as many wild card characters as you want. Note If Interaction Service receives a component interaction with player:play,rickroll custom id, op will be play and name will be rickroll Select Menus Unlike button interactions, select menu interactions also contain the values of the selected menu items. In this case, you should structure your method to accept a string array. Note Use arrays of IUser, IChannel, IRole, IMentionable or their implementations to get data from a select menu with respective type. [ComponentInteraction(\"role_selection\")] public async Task RoleSelection(string[] selectedRoles) { ... } [ComponentInteraction(\"role_selection_*\")] public async Task RoleSelection(string id, string[] selectedRoles) { ... } Note Wildcards may also be used to match a select menu ID, though keep in mind that the array containing the select menu values should be the last parameter. Autocomplete Commands Autocomplete commands must be parameterless methods. A valid Autocomplete command must have the following structure: [AutocompleteCommand(\"parameter_name\", \"command_name\")] public async Task Autocomplete() { string userInput = (Context.Interaction as SocketAutocompleteInteraction).Data.Current.Value.ToString(); IEnumerable results = new[] { new AutocompleteResult(\"foo\", \"foo_value\"), new AutocompleteResult(\"bar\", \"bar_value\"), new AutocompleteResult(\"baz\", \"baz_value\"), }.Where(x => x.Name.StartsWith(userInput, StringComparison.InvariantCultureIgnoreCase)); // only send suggestions that starts with user's input; use case insensitive matching // max - 25 suggestions at a time await (Context.Interaction as SocketAutocompleteInteraction).RespondAsync(results.Take(25)); } // you need to add `Autocomplete` attribute before parameter to add autocompletion to it [SlashCommand(\"command_name\", \"command_description\")] public async Task ExampleCommand([Summary(\"parameter_name\"), Autocomplete] string parameterWithAutocompletion) => await RespondAsync($\"Your choice: {parameterWithAutocompletion}\"); Alternatively, you can use the AutocompleteHandlers to simplify this workflow. Modals Modal commands last parameter must be an implementation of IModal. A Modal implementation would look like this: // Registers a command that will respond with a modal. [SlashCommand(\"food\", \"Tell us about your favorite food.\")] public async Task Command() => await Context.Interaction.RespondWithModalAsync(\"food_menu\"); // Defines the modal that will be sent. public class FoodModal : IModal { public string Title => \"Fav Food\"; // Strings with the ModalTextInput attribute will automatically become components. [InputLabel(\"What??\")] [ModalTextInput(\"food_name\", placeholder: \"Pizza\", maxLength: 20)] public string Food { get; set; } // Additional paremeters can be specified to further customize the input. // Parameters can be optional [RequiredInput(false)] [InputLabel(\"Why??\")] [ModalTextInput(\"food_reason\", TextInputStyle.Paragraph, \"Kuz it's tasty\", maxLength: 500)] public string Reason { get; set; } } // Responds to the modal. [ModalInteraction(\"food_menu\")] public async Task ModalResponse(FoodModal modal) { // Check if \"Why??\" field is populated string reason = string.IsNullOrWhiteSpace(modal.Reason) ? \".\" : $\" because {modal.Reason}\"; // Build the message to send. string message = \"hey @everyone, I just learned \" + $\"{Context.User.Mention}'s favorite food is \" + $\"{modal.Food}{reason}\"; // Specify the AllowedMentions so we don't actually ping everyone. AllowedMentions mentions = new(); mentions.AllowedTypes = AllowedMentionTypes.Users; // Respond to the modal. await RespondAsync(message, allowedMentions: mentions, ephemeral: true); } Note If you are using Modals in the interaction service it is highly recommended that you enable PreCompiledLambdas in your config to prevent performance issues. Interaction Context Every command module provides its commands with an execution context. This context property includes general information about the underlying interaction that triggered the command execution. The base command context. You can design your modules to work with different implementation types of [IInteractionContext]. To achieve this, make sure your module classes inherit from the generic variant of the InteractionModuleBase. Note Context type must be consistent throughout the project, or you will run into issues during runtime. The InteractionService ships with 4 different kinds of InteractionContext: InteractionContext]: A bare-bones execution context consisting of only implementation neutral interfaces SocketInteractionContext: An execution context for use with DiscordSocketClient. Socket entities are exposed in this context without the need of casting them. ShardedInteractionContext: [DiscordShardedClient] variant of the SocketInteractionContext RestInteractionContext: An execution context designed to be used with a DiscordRestClient and webhook based interactions pattern You can create custom Interaction Contexts by implementing the [IInteractionContext] interface. One problem with using the concrete type InteractionContexts is that you cannot access the information that is specific to different interaction types without casting. Concrete type interaction contexts are great for creating shared interaction modules but you can also use the generic variants of the built-in interaction contexts to create interaction specific interaction modules. [!INFO] Message component interactions have access to a special method called UpdateAsync() to update the body of the method the interaction originated from. Normally this wouldn't be accessible without casting the Context.Interaction. discordClient.ButtonExecuted += async (interaction) => { var ctx = new SocketInteractionContext(discordClient, interaction); await _interactionService.ExecuteCommandAsync(ctx, serviceProvider); }; public class MessageComponentModule : InteractionModuleBase> { [ComponentInteraction(\"custom_id\")] public async Task Command() { await Context.Interaction.UpdateAsync(...); } } Loading Modules InteractionService can automatically discover and load modules that inherit InteractionModuleBase from an Assembly. Call InteractionService.AddModulesAsync() to use this functionality. Note You can also manually add Interaction modules using the InteractionService.AddModuleAsync() method by providing the module type you want to load. Resolving Module Dependencies Module dependencies are resolved using the Constructor Injection and Property Injection patterns. Meaning, the constructor parameters and public settable properties of a module will be assigned using the IServiceProvider. For more information on dependency injection, read the DependencyInjection guides. Note On every command execution, if the 'AutoServiceScopes' option is enabled in the config , module dependencies are resolved using a new service scope which allows you to utilize scoped service instances, just like in Asp.Net. Including the precondition checks, every module method is executed using the same service scope and service scopes are disposed right after the AfterExecute method returns. This doesn't apply to methods other than ExecuteAsync(). Module Groups Module groups allow you to create sub-commands and sub-commands groups. By nesting commands inside a module that is tagged with GroupAttribute you can create prefixed commands. Warning Although creating nested module structures are allowed, you are not permitted to use more than 2 GroupAttribute's in module hierarchy. Note To not use the command group's name as a prefix for component or modal interaction's custom id set ignoreGroupNames parameter to true in classes with GroupAttribute However, you have to be careful to prevent overlapping ids of buttons and modals. // You can put commands in groups [Group(\"group-name\", \"Group description\")] public class CommandGroupModule : InteractionModuleBase { // This command will look like // group-name ping [SlashCommand(\"ping\", \"Get a pong\")] public async Task PongSubcommand() => await RespondAsync(\"Pong!\"); // And even in sub-command groups [Group(\"subcommand-group-name\", \"Subcommand group description\")] public class SubСommandGroupModule : InteractionModuleBase { // This command will look like // group-name subcommand-group-name echo [SlashCommand(\"echo\", \"Echo an input\")] public async Task EchoSubcommand(string input) => await RespondAsync(input, components: new ComponentBuilder().WithButton(\"Echo\", $\"echoButton_{input}\").Build()); // Component interaction with ignoreGroupNames set to true [ComponentInteraction(\"echoButton_*\", true)] public async Task EchoButton(string input) => await RespondAsync(input); } } Executing Commands Any of the following socket events can be used to execute commands: InteractionCreated ButtonExecuted SelectMenuExecuted AutocompleteExecuted UserCommandExecuted MessageCommandExecuted ModalExecuted These events will trigger for the specific type of interaction they inherit their name from. The InteractionCreated event will trigger for all. An example of executing a command from an event can be seen here: // Theres multiple ways to subscribe to the event, depending on your application. Please use the approach fit to your type of client. // DiscordSocketClient: _socketClient.InteractionCreated += async (x) => { var ctx = new SocketInteractionContext(_socketClient, x); await _interactionService.ExecuteCommandAsync(ctx, _serviceProvider); } // DiscordShardedClient: _shardedClient.InteractionCreated += async (x) => { var ctx = new ShardedInteractionContext(_shardedClient, x); await _interactionService.ExecuteCommandAsync(ctx, _serviceProvider); } Commands can be either executed on the gateway thread or on a separate thread from the thread pool. This behaviour can be configured by changing the RunMode property of InteractionServiceConfig or by setting the runMode parameter of a command attribute. Warning In the example above, no form of post-execution is presented. Please carefully read the [Post Execution Documentation] for the best approach in resolving the result based on your RunMode. You can also configure the way InteractionService executes the commands. By default, commands are executed using ConstructorInfo.Invoke() to create module instances and MethodInfo.Invoke() method for executing the method bodies. By setting, InteractionServiceConfig.UseCompiledLambda to true, you can make InteractionService create module instances and execute commands using Compiled Lambda expressions. This cuts down on command execution time but it might add some memory overhead. Time it takes to create a module instance and execute a Task.Delay(0) method using the Reflection methods compared to Compiled Lambda expressions: Method Mean Error StdDev ReflectionInvoke 225.93 ns 4.522 ns 7.040 ns CompiledLambda 48.79 ns 0.981 ns 1.276 ns Registering Commands to Discord Application commands loaded to the Interaction Service can be registered to Discord using a number of different methods. In most cases RegisterCommandsGloballyAsync() and RegisterCommandsToGuildAsync() are the methods to use. Command registration methods can only be used after the gateway client is ready or the rest client is logged in. #if DEBUG await interactionService.RegisterCommandsToGuildAsync(); #else await interactionService.RegisterCommandsGloballyAsync(); #endif Methods like AddModulesToGuildAsync(), AddCommandsToGuildAsync(), AddModulesGloballyAsync() and AddCommandsGloballyAsync() can be used to register cherry picked modules or commands to global/guild scopes. Note DontAutoRegisterAttribute can be used on module classes to prevent RegisterCommandsGloballyAsync() and RegisterCommandsToGuildAsync() from registering them to the Discord. Interaction Utility Interaction Service ships with a static InteractionUtility class which contains some helper methods to asynchronously waiting for Discord Interactions. For instance, WaitForInteractionAsync() method allows you to wait for an Interaction for a given amount of time. This method returns the first encountered Interaction that satisfies the provided predicate. Warning If you are running the Interaction Service on RunMode.Sync you should avoid using this method in your commands, as it will block the gateway thread and interrupt your bots connection. Webhook Based Interactions Instead of using the gateway to receive Discord Interactions, Discord allows you to receive Interaction events over Webhooks. Interaction Service also supports this Interaction type but to be able to respond to the Interactions within your command modules you need to perform the following: Make your modules inherit RestInteractionModuleBase Set the ResponseCallback property of InteractionServiceConfig so that the ResponseCallback delegate can be used to create HTTP responses from a deserialized json object string. Use the interaction endpoints of the module base instead of the interaction object (ie. RespondAsync(), FollowupAsync()...). Localization Discord Slash Commands support name/description localization. Localization is available for names and descriptions of Slash Command Groups (GroupAttribute), Slash Commands (SlashCommandAttribute), Slash Command parameters and Slash Command Parameter Choices. Interaction Service can be initialized with an ILocalizationManager instance in its config which is used to create the necessary localization dictionaries on command registration. Interaction Service has two built-in ILocalizationManager implementations: ResxLocalizationManager and JsonLocalizationManager. ResXLocalizationManager ResxLocalizationManager uses . delimited key names to traverse the resource files and get the localized strings (group1.group2.command.parameter.name). A ResxLocalizationManager instance must be initialized with a base resource name, a target assembly and a collection of CultureInfos. Every key path must end with either .name or .description, including parameter choice strings. Discord.Tools.LocalizationTemplate.Resx dotnet tool can be used to create localization file templates. JsonLocalizationManager JsonLocalizationManager uses a nested data structure similar to Discord's Application Commands schema. You can get the Json schema here. JsonLocalizationManager accepts a base path and a base file name and automatically discovers every resource file ( \\basePath\\fileName.locale.json ). A Json resource file should have a structure similar to: { \"command_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\", \"parameter_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\" } }, \"group_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\", \"command_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\", \"parameter_1\":{ \"name\": \"localized_name\", \"description\": \"localized_description\" }, \"parameter_2\":{ \"name\": \"localized_name\", \"description\": \"localized_description\" } } } }" }, "guides/int_framework/permissions.html": { "href": "guides/int_framework/permissions.html", diff --git a/docs/public/main.css b/docs/public/main.css index 29d45ca8..35ffe8f8 100644 --- a/docs/public/main.css +++ b/docs/public/main.css @@ -184,8 +184,20 @@ code { } /* MAKES PARAMETERS MORE SPACIOUS */ -dl.parameters > dt > code { - padding: 3px; +:not(pre) > code { + padding: 3px; +} + +/* MAKES LIST ITEMS BE SLIGHTLY MORE SEPARATED */ +/* THIS AVOIDS CODE BLOCK OVERLAP */ +ul:not(.navbar-nav) > li:not(:last-child) { + margin-bottom: 4px; +} + +/* MAKES NAVBAR LINKS LOOK BETTER IN MOBILE */ +.navbar-expand-md .navbar-nav .nav-link { + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } /* MAKES INHERITANCE LIST READABLE */ diff --git a/docs/public/main.js b/docs/public/main.js index 442fa9fd..6721457f 100644 --- a/docs/public/main.js +++ b/docs/public/main.js @@ -1,14 +1,69 @@ -export default { - iconLinks: [ +export default +{ + iconLinks: + [ { icon: 'github', href: 'https://github.com/discord-net/Discord.Net', title: 'GitHub' }, + { + icon: 'box-seam-fill', + href: 'https://www.nuget.org/packages/Discord.Net/', + title: 'NuGet' + }, { icon: 'discord', href: 'https://discord.gg/dnet', title: 'Discord' } - ] + ], + start: () => + { + // Ugly hack to improve toc filter. + let target = document.getElementById("toc"); + let config = { attributes: false, childList: true, subtree: true }; + let observer = new MutationObserver((list) => + { + for(const mutation of list) + { + if(mutation.type === "childList" && mutation.target == target) + { + let filter = target.getElementsByClassName("form-control")[0]; + + let filterValue = localStorage.getItem("tocFilter"); + let scrollValue = localStorage.getItem("tocScroll"); + + if(filterValue && filterValue !== "") + { + filter.value = filterValue; + + let inputEvent = new Event("input"); + filter.dispatchEvent(inputEvent); + } + + // Add event to store scroll pos. + let tocDiv = target.getElementsByClassName("flex-fill")[0]; + + tocDiv.addEventListener("scroll", (event) => + { + if (event.target.scrollTop >= 0) + { + localStorage.setItem("tocScroll", event.target.scrollTop); + } + }); + + if(scrollValue && scrollValue >= 0) + { + tocDiv.scroll(0, scrollValue); + } + + observer.disconnect(); + break; + } + } + }); + + observer.observe(target, config); + } } diff --git a/docs/xrefmap.yml b/docs/xrefmap.yml index ff667cb3..70f2c804 100644 --- a/docs/xrefmap.yml +++ b/docs/xrefmap.yml @@ -63392,6 +63392,19 @@ references: isSpec: "True" fullName: Discord.Rest.RestUser.AvatarId nameWithType: RestUser.AvatarId +- uid: Discord.Rest.RestUser.BannerColor + name: BannerColor + href: api/Discord.Rest.RestUser.html#Discord_Rest_RestUser_BannerColor + commentId: P:Discord.Rest.RestUser.BannerColor + fullName: Discord.Rest.RestUser.BannerColor + nameWithType: RestUser.BannerColor +- uid: Discord.Rest.RestUser.BannerColor* + name: BannerColor + href: api/Discord.Rest.RestUser.html#Discord_Rest_RestUser_BannerColor_ + commentId: Overload:Discord.Rest.RestUser.BannerColor + isSpec: "True" + fullName: Discord.Rest.RestUser.BannerColor + nameWithType: RestUser.BannerColor - uid: Discord.Rest.RestUser.BannerId name: BannerId href: api/Discord.Rest.RestUser.html#Discord_Rest_RestUser_BannerId @@ -68488,6 +68501,19 @@ references: isSpec: "True" fullName: Discord.SelfUserProperties.Avatar nameWithType: SelfUserProperties.Avatar +- uid: Discord.SelfUserProperties.Banner + name: Banner + href: api/Discord.SelfUserProperties.html#Discord_SelfUserProperties_Banner + commentId: P:Discord.SelfUserProperties.Banner + fullName: Discord.SelfUserProperties.Banner + nameWithType: SelfUserProperties.Banner +- uid: Discord.SelfUserProperties.Banner* + name: Banner + href: api/Discord.SelfUserProperties.html#Discord_SelfUserProperties_Banner_ + commentId: Overload:Discord.SelfUserProperties.Banner + isSpec: "True" + fullName: Discord.SelfUserProperties.Banner + nameWithType: SelfUserProperties.Banner - uid: Discord.SelfUserProperties.Username name: Username href: api/Discord.SelfUserProperties.html#Discord_SelfUserProperties_Username @@ -86432,6 +86458,32 @@ references: isSpec: "True" fullName: Discord.WebSocket.SocketSelfUser.AvatarId nameWithType: SocketSelfUser.AvatarId +- uid: Discord.WebSocket.SocketSelfUser.BannerColor + name: BannerColor + href: api/Discord.WebSocket.SocketSelfUser.html#Discord_WebSocket_SocketSelfUser_BannerColor + commentId: P:Discord.WebSocket.SocketSelfUser.BannerColor + fullName: Discord.WebSocket.SocketSelfUser.BannerColor + nameWithType: SocketSelfUser.BannerColor +- uid: Discord.WebSocket.SocketSelfUser.BannerColor* + name: BannerColor + href: api/Discord.WebSocket.SocketSelfUser.html#Discord_WebSocket_SocketSelfUser_BannerColor_ + commentId: Overload:Discord.WebSocket.SocketSelfUser.BannerColor + isSpec: "True" + fullName: Discord.WebSocket.SocketSelfUser.BannerColor + nameWithType: SocketSelfUser.BannerColor +- uid: Discord.WebSocket.SocketSelfUser.BannerId + name: BannerId + href: api/Discord.WebSocket.SocketSelfUser.html#Discord_WebSocket_SocketSelfUser_BannerId + commentId: P:Discord.WebSocket.SocketSelfUser.BannerId + fullName: Discord.WebSocket.SocketSelfUser.BannerId + nameWithType: SocketSelfUser.BannerId +- uid: Discord.WebSocket.SocketSelfUser.BannerId* + name: BannerId + href: api/Discord.WebSocket.SocketSelfUser.html#Discord_WebSocket_SocketSelfUser_BannerId_ + commentId: Overload:Discord.WebSocket.SocketSelfUser.BannerId + isSpec: "True" + fullName: Discord.WebSocket.SocketSelfUser.BannerId + nameWithType: SocketSelfUser.BannerId - uid: Discord.WebSocket.SocketSelfUser.DiscriminatorValue name: DiscriminatorValue href: api/Discord.WebSocket.SocketSelfUser.html#Discord_WebSocket_SocketSelfUser_DiscriminatorValue