| @@ -13,26 +13,17 @@ trigger: | |||
| jobs: | |||
| - job: Linux | |||
| pool: | |||
| vmImage: 'ubuntu-latest' | |||
| pool: default | |||
| steps: | |||
| - template: azure/build.yml | |||
| - job: Windows_build | |||
| pool: | |||
| vmImage: 'windows-latest' | |||
| condition: ne(variables['Build.SourceBranch'], 'refs/heads/dev') | |||
| steps: | |||
| - template: azure/build.yml | |||
| - job: Windows_deploy | |||
| pool: | |||
| vmImage: 'windows-latest' | |||
| - job: Linux_deploy | |||
| pool: default | |||
| condition: | | |||
| and ( | |||
| succeeded(), | |||
| or ( | |||
| eq(variables['Build.SourceBranch'], 'refs/heads/dev'), | |||
| eq(variables['Build.SourceBranch'], 'refs/heads/release/3.x'), | |||
| eq(variables['buildTag'], True) | |||
| ) | |||
| ) | |||
| @@ -1,4 +1,4 @@ | |||
| If you have too many global commands then you might want to consider doing a bulk overwrite. | |||
| If you have too many global commands then you might want to consider using the bulk overwrite function. | |||
| ```cs | |||
| public async Task Client_Ready() { | |||
| List<ApplicationCommandProperties> applicationCommandProperties = new(); | |||
| @@ -31,7 +31,7 @@ namespace _02_commands_framework.Modules | |||
| [Command("userinfo")] | |||
| public async Task UserInfoAsync(IUser user = null) | |||
| { | |||
| user = user ?? Context.User; | |||
| user ??= Context.User; | |||
| await ReplyAsync(user.ToString()); | |||
| } | |||
| @@ -3,7 +3,7 @@ using System.Linq; | |||
| using System.Reflection; | |||
| using System.Text; | |||
| namespace idn | |||
| namespace Idn | |||
| { | |||
| public static class Inspector | |||
| { | |||
| @@ -13,7 +13,7 @@ using System.Threading; | |||
| using System.Text; | |||
| using System.Diagnostics; | |||
| namespace idn | |||
| namespace Idn | |||
| { | |||
| public class Program | |||
| { | |||
| @@ -116,7 +116,7 @@ namespace Discord.Commands | |||
| builder.AddAliases(alias.Aliases); | |||
| break; | |||
| case GroupAttribute group: | |||
| builder.Name = builder.Name ?? group.Prefix; | |||
| builder.Name ??= group.Prefix; | |||
| builder.Group = group.Prefix; | |||
| builder.AddAliases(group.Prefix); | |||
| break; | |||
| @@ -158,7 +158,7 @@ namespace Discord.Commands | |||
| case CommandAttribute command: | |||
| builder.AddAliases(command.Text); | |||
| builder.RunMode = command.RunMode; | |||
| builder.Name = builder.Name ?? command.Text; | |||
| builder.Name ??= command.Text; | |||
| builder.IgnoreExtraArgs = command.IgnoreExtraArgs ?? service._ignoreExtraArgs; | |||
| break; | |||
| case NameAttribute name: | |||
| @@ -131,7 +131,7 @@ namespace Discord.Commands.Builders | |||
| internal ParameterInfo Build(CommandInfo info) | |||
| { | |||
| if ((TypeReader ?? (TypeReader = GetReader(ParameterType))) == null) | |||
| if ((TypeReader ??= GetReader(ParameterType)) == null) | |||
| throw new InvalidOperationException($"No type reader found for type {ParameterType.Name}, one must be specified"); | |||
| return new ParameterInfo(this, info, Command.Module.Service); | |||
| @@ -189,7 +189,7 @@ namespace Discord.Commands | |||
| /// </returns> | |||
| public async Task<ModuleInfo> AddModuleAsync(Type type, IServiceProvider services) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| await _moduleLock.WaitAsync().ConfigureAwait(false); | |||
| try | |||
| @@ -224,7 +224,7 @@ namespace Discord.Commands | |||
| /// </returns> | |||
| public async Task<IEnumerable<ModuleInfo>> AddModulesAsync(Assembly assembly, IServiceProvider services) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| await _moduleLock.WaitAsync().ConfigureAwait(false); | |||
| try | |||
| @@ -507,7 +507,7 @@ namespace Discord.Commands | |||
| /// </returns> | |||
| public async Task<IResult> ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| var searchResult = Search(input); | |||
| if (!searchResult.IsSuccess) | |||
| @@ -1129,7 +1129,7 @@ | |||
| <seealso cref="T:Discord.Commands.ICommandContext" /> | |||
| <seealso cref="T:Discord.Commands.CommandContext" /> | |||
| </member> | |||
| <member name="M:Discord.Commands.ModuleBase`1.ReplyAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||
| <member name="M:Discord.Commands.ModuleBase`1.ReplyAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||
| <summary> | |||
| Sends a message to the source channel. | |||
| </summary> | |||
| @@ -1142,9 +1142,11 @@ | |||
| Specifies if notifications are sent for mentioned users and roles in the <paramref name="message"/>. | |||
| If <c>null</c>, all mentioned roles and users will be notified. | |||
| </param> | |||
| <param name="options">The request options for this async request.</param> | |||
| <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| <param name="stickers">A collection of stickers to send with the file.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| </member> | |||
| <member name="M:Discord.Commands.ModuleBase`1.BeforeExecute(Discord.Commands.CommandInfo)"> | |||
| <summary> | |||
| @@ -51,8 +51,7 @@ namespace Discord.Commands | |||
| if (endPos == -1) return false; | |||
| if (text.Length < endPos + 2 || text[endPos + 1] != ' ') return false; //Must end in "> " | |||
| ulong userId; | |||
| if (!MentionUtils.TryParseUser(text.Substring(0, endPos + 1), out userId)) return false; | |||
| if (!MentionUtils.TryParseUser(text.Substring(0, endPos + 1), out ulong userId)) return false; | |||
| if (userId == user.Id) | |||
| { | |||
| argPos = endPos + 2; | |||
| @@ -123,7 +123,7 @@ namespace Discord.Commands | |||
| public async Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext context, IServiceProvider services = null) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| async Task<PreconditionResult> CheckGroups(IEnumerable<PreconditionAttribute> preconditions, string type) | |||
| { | |||
| @@ -164,7 +164,7 @@ namespace Discord.Commands | |||
| public async Task<ParseResult> ParseAsync(ICommandContext context, int startIndex, SearchResult searchResult, PreconditionResult preconditionResult = null, IServiceProvider services = null) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| if (!searchResult.IsSuccess) | |||
| return ParseResult.FromError(searchResult); | |||
| @@ -201,7 +201,7 @@ namespace Discord.Commands | |||
| } | |||
| public async Task<IResult> ExecuteAsync(ICommandContext context, IEnumerable<object> argList, IEnumerable<object> paramList, IServiceProvider services) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| try | |||
| { | |||
| @@ -75,7 +75,7 @@ namespace Discord.Commands | |||
| public async Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext context, object arg, IServiceProvider services = null) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| foreach (var precondition in Preconditions) | |||
| { | |||
| @@ -89,7 +89,7 @@ namespace Discord.Commands | |||
| public async Task<TypeReaderResult> ParseAsync(ICommandContext context, string input, IServiceProvider services = null) | |||
| { | |||
| services = services ?? EmptyServiceProvider.Instance; | |||
| services ??= EmptyServiceProvider.Instance; | |||
| return await _reader.ReadAsync(context, input, services).ConfigureAwait(false); | |||
| } | |||
| @@ -36,12 +36,14 @@ namespace Discord.Commands | |||
| /// Specifies if notifications are sent for mentioned users and roles in the <paramref name="message"/>. | |||
| /// If <c>null</c>, all mentioned roles and users will be notified. | |||
| /// </param> | |||
| /// <param name="options">The request options for this async request.</param> | |||
| /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| /// <param name="stickers">A collection of stickers to send with the file.</param> | |||
| protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||
| { | |||
| return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||
| return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||
| } | |||
| /// <summary> | |||
| /// The method to execute before executing the command. | |||
| @@ -181,7 +181,7 @@ namespace Discord | |||
| /// Gets a stickers url based off the id and format. | |||
| /// </summary> | |||
| /// <param name="stickerId">The id of the sticker.</param> | |||
| /// <param name="format">The format of the sticker</param> | |||
| /// <param name="format">The format of the sticker.</param> | |||
| /// <returns> | |||
| /// A URL to the sticker. | |||
| /// </returns> | |||
| @@ -190,37 +190,26 @@ namespace Discord | |||
| private static string FormatToExtension(StickerFormatType format) | |||
| { | |||
| switch (format) | |||
| return format switch | |||
| { | |||
| case StickerFormatType.None: | |||
| case StickerFormatType.Png: | |||
| case StickerFormatType.Apng: // In the case of the Sticker endpoint, the sticker will be available as PNG if its format_type is PNG or APNG, and as Lottie if its format_type is LOTTIE. | |||
| return "png"; | |||
| case StickerFormatType.Lottie: | |||
| return "lottie"; | |||
| default: | |||
| throw new ArgumentException(nameof(format)); | |||
| } | |||
| StickerFormatType.None or StickerFormatType.Png or StickerFormatType.Apng => "png", // In the case of the Sticker endpoint, the sticker will be available as PNG if its format_type is PNG or APNG, and as Lottie if its format_type is LOTTIE. | |||
| StickerFormatType.Lottie => "lottie", | |||
| _ => throw new ArgumentException(nameof(format)), | |||
| }; | |||
| } | |||
| private static string FormatToExtension(ImageFormat format, string imageId) | |||
| { | |||
| if (format == ImageFormat.Auto) | |||
| format = imageId.StartsWith("a_") ? ImageFormat.Gif : ImageFormat.Png; | |||
| switch (format) | |||
| return format switch | |||
| { | |||
| case ImageFormat.Gif: | |||
| return "gif"; | |||
| case ImageFormat.Jpeg: | |||
| return "jpeg"; | |||
| case ImageFormat.Png: | |||
| return "png"; | |||
| case ImageFormat.WebP: | |||
| return "webp"; | |||
| default: | |||
| throw new ArgumentException(nameof(format)); | |||
| } | |||
| ImageFormat.Gif => "gif", | |||
| ImageFormat.Jpeg => "jpeg", | |||
| ImageFormat.Png => "png", | |||
| ImageFormat.WebP => "webp", | |||
| _ => throw new ArgumentException(nameof(format)), | |||
| }; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
| <Import Project="../../Discord.Net.targets" /> | |||
| <Import Project="../../StyleAnalyzer.targets"/> | |||
| <PropertyGroup> | |||
| @@ -217,7 +217,7 @@ | |||
| Gets a stickers url based off the id and format. | |||
| </summary> | |||
| <param name="stickerId">The id of the sticker.</param> | |||
| <param name="format">The format of the sticker</param> | |||
| <param name="format">The format of the sticker.</param> | |||
| <returns> | |||
| A URL to the sticker. | |||
| </returns> | |||
| @@ -1507,7 +1507,7 @@ | |||
| Represents a generic channel that can send and receive messages. | |||
| </summary> | |||
| </member> | |||
| <member name="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||
| <member name="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||
| <summary> | |||
| Sends a message to this message channel. | |||
| </summary> | |||
| @@ -1526,14 +1526,15 @@ | |||
| If <c>null</c>, all mentioned roles and users will be notified. | |||
| </param> | |||
| <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| <param name="stickers">A collection of stickers to send with the message.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| <returns> | |||
| A task that represents an asynchronous send operation for delivering the message. The task result | |||
| contains the sent message. | |||
| </returns> | |||
| </member> | |||
| <member name="M:Discord.IMessageChannel.SendFileAsync(System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||
| <member name="M:Discord.IMessageChannel.SendFileAsync(System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||
| <summary> | |||
| Sends a file to this message channel with an optional caption. | |||
| </summary> | |||
| @@ -1566,14 +1567,15 @@ | |||
| If <c>null</c>, all mentioned roles and users will be notified. | |||
| </param> | |||
| <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| <param name="stickers">A collection of stickers to send with the file.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| <returns> | |||
| A task that represents an asynchronous send operation for delivering the message. The task result | |||
| contains the sent message. | |||
| </returns> | |||
| </member> | |||
| <member name="M:Discord.IMessageChannel.SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||
| <member name="M:Discord.IMessageChannel.SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||
| <summary> | |||
| Sends a file to this message channel with an optional caption. | |||
| </summary> | |||
| @@ -1603,8 +1605,9 @@ | |||
| If <c>null</c>, all mentioned roles and users will be notified. | |||
| </param> | |||
| <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| <param name="stickers">A collection of stickers to send with the file.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| <returns> | |||
| A task that represents an asynchronous send operation for delivering the message. The task result | |||
| contains the sent message. | |||
| @@ -1869,7 +1872,7 @@ | |||
| await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); | |||
| </code> | |||
| </example> | |||
| <param name="applicationId">The id of the embedded application to open for this invite</param> | |||
| <param name="applicationId">The id of the embedded application to open for this invite.</param> | |||
| <param name="maxAge">The time (in seconds) until the invite expires. Set to <c>null</c> to never expire.</param> | |||
| <param name="maxUses">The max amount of times this invite may be used. Set to <c>null</c> to have unlimited uses.</param> | |||
| <param name="isTemporary">If <c>true</c>, the user accepting this invite will be kicked from the guild after closing their client.</param> | |||
| @@ -1891,7 +1894,7 @@ | |||
| await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); | |||
| </code> | |||
| </example> | |||
| <param name="user">The id of the user whose stream to display for this invite</param> | |||
| <param name="user">The id of the user whose stream to display for this invite.</param> | |||
| <param name="maxAge">The time (in seconds) until the invite expires. Set to <c>null</c> to never expire.</param> | |||
| <param name="maxUses">The max amount of times this invite may be used. Set to <c>null</c> to have unlimited uses.</param> | |||
| <param name="isTemporary">If <c>true</c>, the user accepting this invite will be kicked from the guild after closing their client.</param> | |||
| @@ -1978,7 +1981,7 @@ | |||
| Starts the stage, creating a stage instance. | |||
| </summary> | |||
| <param name="topic">The topic for the stage/</param> | |||
| <param name="privacyLevel">The privacy level of the stage</param> | |||
| <param name="privacyLevel">The privacy level of the stage.</param> | |||
| <param name="options">The options to be used when sending the request.</param> | |||
| <returns> | |||
| A task that represents the asynchronous start operation. | |||
| @@ -3995,7 +3998,7 @@ | |||
| <param name="description">The description of the sticker.</param> | |||
| <param name="tags">The tags of the sticker.</param> | |||
| <param name="stream">The stream containing the file data.</param> | |||
| <param name="filename">The name of the file <b>with</b> the extension, ex: image.png</param> | |||
| <param name="filename">The name of the file <b>with</b> the extension, ex: image.png.</param> | |||
| <param name="options">The options to be used when sending the request.</param> | |||
| <returns> | |||
| A task that represents the asynchronous creation operation. The task result contains the created sticker. | |||
| @@ -4508,37 +4511,42 @@ | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Name"> | |||
| <summary> | |||
| The name of this option. | |||
| Gets or sets the name of this option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Description"> | |||
| <summary> | |||
| The description of this option. | |||
| Gets or sets the description of this option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Type"> | |||
| <summary> | |||
| The type of this option. | |||
| Gets or sets the type of this option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Default"> | |||
| <summary> | |||
| The first required option for the user to complete. only one option can be default. | |||
| Gets or sets whether or not this options is the first required option for the user to complete. only one option can be default. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Required"> | |||
| <summary> | |||
| <see langword="true"/> if this option is required for this command, otherwise <see langword="false"/>. | |||
| Gets or sets if the option is required. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Autocomplete"> | |||
| <summary> | |||
| Gets or sets whether or not this option supports autocomplete. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Choices"> | |||
| <summary> | |||
| choices for string and int types for the user to pick from. | |||
| Gets or sets the choices for string and int types for the user to pick from. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.ApplicationCommandOptionProperties.Options"> | |||
| <summary> | |||
| If the option is a subcommand or subcommand group type, this nested options will be the parameters. | |||
| Gets or sets if this option is a subcommand or subcommand group type, these nested options will be the parameters. | |||
| </summary> | |||
| </member> | |||
| <member name="T:Discord.ApplicationCommandOptionChoiceProperties"> | |||
| @@ -4649,6 +4657,68 @@ | |||
| ApplicationCommandType.Message is Context Menu Message command type | |||
| </summary> | |||
| </member> | |||
| <member name="T:Discord.AutocompleteOption"> | |||
| <summary> | |||
| Represents an autocomplete option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.AutocompleteOption.Type"> | |||
| <summary> | |||
| Gets the type of this option | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.AutocompleteOption.Name"> | |||
| <summary> | |||
| Gets the name of the option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.AutocompleteOption.Value"> | |||
| <summary> | |||
| Gets the value of the option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.AutocompleteOption.Focused"> | |||
| <summary> | |||
| Gets whether or not this option is focused by the executing user. | |||
| </summary> | |||
| </member> | |||
| <member name="T:Discord.AutocompleteResult"> | |||
| <summary> | |||
| Represents a result to an autocomplete interaction. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.AutocompleteResult.Name"> | |||
| <summary> | |||
| Gets or sets the name of the result. | |||
| </summary> | |||
| <remarks> | |||
| Name cannot be null and has to be between 1-100 characters in length. | |||
| </remarks> | |||
| <exception cref="T:System.ArgumentNullException"/> | |||
| <exception cref="T:System.ArgumentException"/> | |||
| </member> | |||
| <member name="P:Discord.AutocompleteResult.Value"> | |||
| <summary> | |||
| Gets or sets the value of the result. | |||
| </summary> | |||
| <remarks> | |||
| Only <see cref="T:System.String"/>, <see cref="T:System.Int32"/>, and <see cref="T:System.Double"/> are allowed for a value. | |||
| </remarks> | |||
| <exception cref="T:System.ArgumentNullException"/> | |||
| <exception cref="T:System.ArgumentException"/> | |||
| </member> | |||
| <member name="M:Discord.AutocompleteResult.#ctor"> | |||
| <summary> | |||
| Creates a new <see cref="T:Discord.AutocompleteResult"/>. | |||
| </summary> | |||
| </member> | |||
| <member name="M:Discord.AutocompleteResult.#ctor(System.String,System.Object)"> | |||
| <summary> | |||
| Creates a new <see cref="T:Discord.AutocompleteResult"/> with the passed in <paramref name="name"/> and <paramref name="value"/>. | |||
| </summary> | |||
| <exception cref="T:System.ArgumentNullException"/> | |||
| <exception cref="T:System.ArgumentException"/> | |||
| </member> | |||
| <member name="T:Discord.MessageCommandBuilder"> | |||
| <summary> | |||
| A class used to build Message commands. | |||
| @@ -4849,7 +4919,11 @@ | |||
| Present if this option is a group or subcommand. | |||
| </summary> | |||
| </member> | |||
| <!-- Badly formed XML comment ignored for member "T:Discord.IApplicationCommandOption" --> | |||
| <member name="T:Discord.IApplicationCommandOption"> | |||
| <summary> | |||
| Options for the <see cref="T:Discord.IApplicationCommand"/>, see <see href="https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption">The docs</see>. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.IApplicationCommandOption.Type"> | |||
| <summary> | |||
| The type of this <see cref="T:Discord.IApplicationCommandOption"/>. | |||
| @@ -4939,25 +5013,25 @@ | |||
| Responds to an Interaction with type <see cref="F:Discord.InteractionResponseType.ChannelMessageWithSource"/>. | |||
| </summary> | |||
| <param name="text">The text of the message to be sent.</param> | |||
| <param name="embeds">A array of embeds to send with this response. Max 10</param> | |||
| <param name="embeds">A array of embeds to send with this response. Max 10.</param> | |||
| <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param> | |||
| <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param> | |||
| <param name="allowedMentions">The allowed mentions for this response.</param> | |||
| <param name="options">The request options for this response.</param> | |||
| <param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response</param> | |||
| <param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response.</param> | |||
| <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param> | |||
| </member> | |||
| <member name="M:Discord.IDiscordInteraction.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)"> | |||
| <summary> | |||
| Sends a followup message for this interaction. | |||
| </summary> | |||
| <param name="text">The text of the message to be sent</param> | |||
| <param name="embeds">A array of embeds to send with this response. Max 10</param> | |||
| <param name="text">The text of the message to be sent.</param> | |||
| <param name="embeds">A array of embeds to send with this response. Max 10.</param> | |||
| <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param> | |||
| <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param> | |||
| <param name="allowedMentions">The allowed mentions for this response.</param> | |||
| <param name="options">The request options for this response.</param> | |||
| <param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response</param> | |||
| <param name="component">A <see cref="T:Discord.MessageComponent"/> to be sent with this response.</param> | |||
| <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param> | |||
| <returns> | |||
| The sent message. | |||
| @@ -5029,12 +5103,17 @@ | |||
| </member> | |||
| <member name="F:Discord.InteractionResponseType.DeferredUpdateMessage"> | |||
| <summary> | |||
| for components: ACK an interaction and edit the original message later; the user does not see a loading state | |||
| For components: ACK an interaction and edit the original message later; the user does not see a loading state | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.InteractionResponseType.UpdateMessage"> | |||
| <summary> | |||
| for components: edit the message the component was attached to | |||
| For components: edit the message the component was attached to | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.InteractionResponseType.ApplicationCommandAutocompleteResult"> | |||
| <summary> | |||
| Respond with a set of choices to a autocomplete interaction | |||
| </summary> | |||
| </member> | |||
| <member name="T:Discord.InteractionType"> | |||
| @@ -5057,6 +5136,11 @@ | |||
| A <see cref="T:Discord.IMessageComponent"/> sent from discord. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.InteractionType.ApplicationCommandAutocomplete"> | |||
| <summary> | |||
| An autocomplete request sent from discord. | |||
| </summary> | |||
| </member> | |||
| <member name="T:Discord.ActionRowComponent"> | |||
| <summary> | |||
| Represents a <see cref="T:Discord.IMessageComponent"/> Row for child components to live in. | |||
| @@ -5240,7 +5324,7 @@ | |||
| <summary> | |||
| Builds this builder into a <see cref="T:Discord.MessageComponent"/> used to send your components. | |||
| </summary> | |||
| <returns>A <see cref="T:Discord.MessageComponent"/> that can be sent with <see cref="!:IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent)"/>.</returns> | |||
| <returns>A <see cref="T:Discord.MessageComponent"/> that can be sent with <see cref="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"/>.</returns> | |||
| </member> | |||
| <member name="T:Discord.ActionRowBuilder"> | |||
| <summary> | |||
| @@ -5336,10 +5420,10 @@ | |||
| </summary> | |||
| <param name="label">The label to use on the newly created link button.</param> | |||
| <param name="url">The url of this button.</param> | |||
| <param name="customId">The custom ID of this button</param> | |||
| <param name="style">The custom ID of this button</param> | |||
| <param name="emote">The emote of this button</param> | |||
| <param name="disabled">Disabled this button or not</param> | |||
| <param name="customId">The custom ID of this button.</param> | |||
| <param name="style">The custom ID of this button.</param> | |||
| <param name="emote">The emote of this button.</param> | |||
| <param name="disabled">Disabled this button or not.</param> | |||
| </member> | |||
| <member name="M:Discord.ButtonBuilder.#ctor(Discord.ButtonComponent)"> | |||
| <summary> | |||
| @@ -5352,7 +5436,7 @@ | |||
| </summary> | |||
| <param name="label">The label for this link button.</param> | |||
| <param name="url">The url for this link button to go to.</param> | |||
| <param name="emote">The emote for this link button</param> | |||
| <param name="emote">The emote for this link button.</param> | |||
| <returns>A builder with the newly created button.</returns> | |||
| </member> | |||
| <member name="M:Discord.ButtonBuilder.CreateDangerButton(System.String,System.String,Discord.IEmote)"> | |||
| @@ -5361,7 +5445,7 @@ | |||
| </summary> | |||
| <param name="label">The label for this danger button.</param> | |||
| <param name="customId">The custom id for this danger button.</param> | |||
| <param name="emote">The emote for this danger button</param> | |||
| <param name="emote">The emote for this danger button.</param> | |||
| <returns>A builder with the newly created button.</returns> | |||
| </member> | |||
| <member name="M:Discord.ButtonBuilder.CreatePrimaryButton(System.String,System.String,Discord.IEmote)"> | |||
| @@ -5370,7 +5454,7 @@ | |||
| </summary> | |||
| <param name="label">The label for this primary button.</param> | |||
| <param name="customId">The custom id for this primary button.</param> | |||
| <param name="emote">The emote for this primary button</param> | |||
| <param name="emote">The emote for this primary button.</param> | |||
| <returns>A builder with the newly created button.</returns> | |||
| </member> | |||
| <member name="M:Discord.ButtonBuilder.CreateSecondaryButton(System.String,System.String,Discord.IEmote)"> | |||
| @@ -5379,7 +5463,7 @@ | |||
| </summary> | |||
| <param name="label">The label for this secondary button.</param> | |||
| <param name="customId">The custom id for this secondary button.</param> | |||
| <param name="emote">The emote for this secondary button</param> | |||
| <param name="emote">The emote for this secondary button.</param> | |||
| <returns>A builder with the newly created button.</returns> | |||
| </member> | |||
| <member name="M:Discord.ButtonBuilder.CreateSuccessButton(System.String,System.String,Discord.IEmote)"> | |||
| @@ -5388,14 +5472,14 @@ | |||
| </summary> | |||
| <param name="label">The label for this success button.</param> | |||
| <param name="customId">The custom id for this success button.</param> | |||
| <param name="emote">The emote for this success button</param> | |||
| <param name="emote">The emote for this success button.</param> | |||
| <returns>A builder with the newly created button.</returns> | |||
| </member> | |||
| <member name="M:Discord.ButtonBuilder.WithLabel(System.String)"> | |||
| <summary> | |||
| Sets the current buttons label to the specified text. | |||
| </summary> | |||
| <param name="label">The text for the label</param> | |||
| <param name="label">The text for the label.</param> | |||
| <inheritdoc cref="P:Discord.ButtonBuilder.Label"/> | |||
| <returns>The current builder.</returns> | |||
| </member> | |||
| @@ -5934,7 +6018,7 @@ | |||
| <param name="value">The default permission value to set.</param> | |||
| <returns>The current builder.</returns> | |||
| </member> | |||
| <member name="M:Discord.SlashCommandBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Boolean,System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])"> | |||
| <member name="M:Discord.SlashCommandBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])"> | |||
| <summary> | |||
| Adds an option to the current slash command. | |||
| </summary> | |||
| @@ -5943,6 +6027,7 @@ | |||
| <param name="description">The description of this option.</param> | |||
| <param name="required">If this option is required for this command.</param> | |||
| <param name="isDefault">If this option is the default option.</param> | |||
| <param name="isAutocomplete">If this option is set to autocompleate.</param> | |||
| <param name="options">The options of the option to add.</param> | |||
| <param name="choices">The choices of this option.</param> | |||
| <returns>The current builder.</returns> | |||
| @@ -5987,37 +6072,42 @@ | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Name"> | |||
| <summary> | |||
| The name of this option. | |||
| Gets or sets the name of this option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Description"> | |||
| <summary> | |||
| The description of this option. | |||
| Gets or sets the description of this option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Type"> | |||
| <summary> | |||
| The type of this option. | |||
| Gets or sets the type of this option. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Default"> | |||
| <summary> | |||
| The first required option for the user to complete. only one option can be default. | |||
| Gets or sets whether or not this options is the first required option for the user to complete. only one option can be default. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Required"> | |||
| <summary> | |||
| <see langword="true"/> if this option is required for this command, otherwise <see langword="false"/>. | |||
| Gets or sets if the option is required. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Autocomplete"> | |||
| <summary> | |||
| Gets or sets whether or not this option supports autocomplete. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Choices"> | |||
| <summary> | |||
| choices for string and int types for the user to pick from. | |||
| Gets or sets the choices for string and int types for the user to pick from. | |||
| </summary> | |||
| </member> | |||
| <member name="P:Discord.SlashCommandOptionBuilder.Options"> | |||
| <summary> | |||
| If the option is a subcommand or subcommand group type, this nested options will be the parameters. | |||
| Gets or sets if this option is a subcommand or subcommand group type, these nested options will be the parameters. | |||
| </summary> | |||
| </member> | |||
| <member name="M:Discord.SlashCommandOptionBuilder.Build"> | |||
| @@ -6026,7 +6116,7 @@ | |||
| </summary> | |||
| <returns>The built version of this option.</returns> | |||
| </member> | |||
| <member name="M:Discord.SlashCommandOptionBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Boolean,System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])"> | |||
| <member name="M:Discord.SlashCommandOptionBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Nullable{System.Boolean},System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])"> | |||
| <summary> | |||
| Adds an option to the current slash command. | |||
| </summary> | |||
| @@ -8516,7 +8606,12 @@ | |||
| Allows members to use slash commands in text channels. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermission.RequesToSpeak"> | |||
| <member name="F:Discord.ChannelPermission.UseApplicationCommands"> | |||
| <summary> | |||
| Allows members to use slash commands in text channels. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermission.RequestToSpeak"> | |||
| <summary> | |||
| Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.) | |||
| </summary> | |||
| @@ -8536,106 +8631,158 @@ | |||
| Allows for creating and participating in private threads | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermission.CreatePublicThreads"> | |||
| <summary> | |||
| Allows for creating public threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermission.CreatePrivateThreads"> | |||
| <summary> | |||
| Allows for creating private threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermission.UseExternalStickers"> | |||
| <summary> | |||
| Allows the usage of custom stickers from other servers. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermission.SendMessagesInThreads"> | |||
| <summary> | |||
| Allows for sending messages in threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermission.StartEmbeddedActivities"> | |||
| <summary> | |||
| Allows for launching activities (applications with the EMBEDDED flag) in a voice channel. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermissions.None"> | |||
| <summary> Gets a blank <see cref="T:Discord.ChannelPermissions"/> that grants no permissions. </summary> | |||
| <returns> A <see cref="T:Discord.ChannelPermissions"/> structure that does not contain any set permissions. </returns> | |||
| <summary> Gets a blank <see cref="T:Discord.ChannelPermissions"/> that grants no permissions.</summary> | |||
| <returns> A <see cref="T:Discord.ChannelPermissions"/> structure that does not contain any set permissions.</returns> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermissions.Text"> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for text channels. </summary> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for text channels.</summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermissions.Voice"> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for voice channels. </summary> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for voice channels.</summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermissions.Stage"> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for stage channels.</summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermissions.Category"> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for category channels. </summary> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for category channels.</summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermissions.DM"> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for direct message channels. </summary> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for direct message channels.</summary> | |||
| </member> | |||
| <member name="F:Discord.ChannelPermissions.Group"> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for group channels. </summary> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for group channels.</summary> | |||
| </member> | |||
| <member name="M:Discord.ChannelPermissions.All(Discord.IChannel)"> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for a given channel type. </summary> | |||
| <summary> Gets a <see cref="T:Discord.ChannelPermissions"/> that grants all permissions for a given channel type.</summary> | |||
| <exception cref="T:System.ArgumentException">Unknown channel type.</exception> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.RawValue"> | |||
| <summary> Gets a packed value representing all the permissions in this <see cref="T:Discord.ChannelPermissions"/>. </summary> | |||
| <summary> Gets a packed value representing all the permissions in this <see cref="T:Discord.ChannelPermissions"/>.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.CreateInstantInvite"> | |||
| <summary> If <c>true</c>, a user may create invites. </summary> | |||
| <summary> If <c>true</c>, a user may create invites.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.ManageChannel"> | |||
| <summary> If <c>true</c>, a user may create, delete and modify this channel. </summary> | |||
| <summary> If <c>true</c>, a user may create, delete and modify this channel.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.AddReactions"> | |||
| <summary> If <c>true</c>, a user may add reactions. </summary> | |||
| <summary> If <c>true</c>, a user may add reactions.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.ViewChannel"> | |||
| <summary> If <c>true</c>, a user may view channels. </summary> | |||
| <summary> If <c>true</c>, a user may view channels.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.SendMessages"> | |||
| <summary> If <c>true</c>, a user may send messages. </summary> | |||
| <summary> If <c>true</c>, a user may send messages.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.SendTTSMessages"> | |||
| <summary> If <c>true</c>, a user may send text-to-speech messages. </summary> | |||
| <summary> If <c>true</c>, a user may send text-to-speech messages.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.ManageMessages"> | |||
| <summary> If <c>true</c>, a user may delete messages. </summary> | |||
| <summary> If <c>true</c>, a user may delete messages.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.EmbedLinks"> | |||
| <summary> If <c>true</c>, Discord will auto-embed links sent by this user. </summary> | |||
| <summary> If <c>true</c>, Discord will auto-embed links sent by this user.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.AttachFiles"> | |||
| <summary> If <c>true</c>, a user may send files. </summary> | |||
| <summary> If <c>true</c>, a user may send files.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.ReadMessageHistory"> | |||
| <summary> If <c>true</c>, a user may read previous messages. </summary> | |||
| <summary> If <c>true</c>, a user may read previous messages.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.MentionEveryone"> | |||
| <summary> If <c>true</c>, a user may mention @everyone. </summary> | |||
| <summary> If <c>true</c>, a user may mention @everyone.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.UseExternalEmojis"> | |||
| <summary> If <c>true</c>, a user may use custom emoji from other guilds. </summary> | |||
| <summary> If <c>true</c>, a user may use custom emoji from other guilds.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.Connect"> | |||
| <summary> If <c>true</c>, a user may connect to a voice channel. </summary> | |||
| <summary> If <c>true</c>, a user may connect to a voice channel.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.Speak"> | |||
| <summary> If <c>true</c>, a user may speak in a voice channel. </summary> | |||
| <summary> If <c>true</c>, a user may speak in a voice channel.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.MuteMembers"> | |||
| <summary> If <c>true</c>, a user may mute users. </summary> | |||
| <summary> If <c>true</c>, a user may mute users.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.DeafenMembers"> | |||
| <summary> If <c>true</c>, a user may deafen users. </summary> | |||
| <summary> If <c>true</c>, a user may deafen users.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.MoveMembers"> | |||
| <summary> If <c>true</c>, a user may move other users between voice channels. </summary> | |||
| <summary> If <c>true</c>, a user may move other users between voice channels.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.UseVAD"> | |||
| <summary> If <c>true</c>, a user may use voice-activity-detection rather than push-to-talk. </summary> | |||
| <summary> If <c>true</c>, a user may use voice-activity-detection rather than push-to-talk.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.PrioritySpeaker"> | |||
| <summary> If <c>true</c>, a user may use priority speaker in a voice channel. </summary> | |||
| <summary> If <c>true</c>, a user may use priority speaker in a voice channel.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.Stream"> | |||
| <summary> If <c>true</c>, a user may stream video in a voice channel. </summary> | |||
| <summary> If <c>true</c>, a user may stream video in a voice channel.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.ManageRoles"> | |||
| <summary> If <c>true</c>, a user may adjust role permissions. This also implictly grants all other permissions. </summary> | |||
| <summary> If <c>true</c>, a user may adjust role permissions. This also implictly grants all other permissions.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.ManageWebhooks"> | |||
| <summary> If <c>true</c>, a user may edit the webhooks for this channel. </summary> | |||
| <summary> If <c>true</c>, a user may edit the webhooks for this channel.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.UseApplicationCommands"> | |||
| <summary> If <c>true</c>, a user may use application commands in this guild.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.RequestToSpeak"> | |||
| <summary> If <c>true</c>, a user may request to speak in stage channels.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.ManageThreads"> | |||
| <summary> If <c>true</c>, a user may manage threads in this guild.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.CreatePublicThreads"> | |||
| <summary> If <c>true</c>, a user may create public threads in this guild.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.CreatePrivateThreads"> | |||
| <summary> If <c>true</c>, a user may create private threads in this guild.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.UseExternalStickers"> | |||
| <summary> If <c>true</c>, a user may use external stickers in this guild.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.SendMessagesInThreads"> | |||
| <summary> If <c>true</c>, a user may send messages in threads in this guild.</summary> | |||
| </member> | |||
| <member name="P:Discord.ChannelPermissions.StartEmbeddedActivities"> | |||
| <summary> If <c>true</c>, a user launch application activites in voice channels in this guild.</summary> | |||
| </member> | |||
| <member name="M:Discord.ChannelPermissions.#ctor(System.UInt64)"> | |||
| <summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided packed value. </summary> | |||
| <summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided packed value.</summary> | |||
| </member> | |||
| <member name="M:Discord.ChannelPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)"> | |||
| <summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided permissions. </summary> | |||
| <member name="M:Discord.ChannelPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)"> | |||
| <summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> with the provided permissions.</summary> | |||
| </member> | |||
| <member name="M:Discord.ChannelPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})"> | |||
| <summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> from this one, changing the provided non-null permissions. </summary> | |||
| <member name="M:Discord.ChannelPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})"> | |||
| <summary> Creates a new <see cref="T:Discord.ChannelPermissions"/> from this one, changing the provided non-null permissions.</summary> | |||
| </member> | |||
| <member name="T:Discord.GuildApplicationCommandPermission"> | |||
| <summary> | |||
| @@ -8862,6 +9009,11 @@ | |||
| Allows members to use slash commands in text channels. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.UseApplicationCommands"> | |||
| <summary> | |||
| Allows members to use application commands like slash commands and context menus in text channels. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.RequestToSpeak"> | |||
| <summary> | |||
| Allows for requesting to speak in stage channels. <i>(This permission is under active development and may be changed or removed.)</i>. | |||
| @@ -8876,14 +9028,24 @@ | |||
| authentication when used on a guild that has server-wide 2FA enabled. | |||
| </remarks> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.CreatePublicThreads"> | |||
| <summary> | |||
| Allows for creating public threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.CreatePrivateThreads"> | |||
| <summary> | |||
| Allows for creating private threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.UsePublicThreads"> | |||
| <summary> | |||
| Allows for creating and participating in threads. | |||
| Allows for creating public threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.UsePrivateThreads"> | |||
| <summary> | |||
| Allows for creating and participating in private threads. | |||
| Allows for creating private threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.UseExternalStickers"> | |||
| @@ -8891,6 +9053,16 @@ | |||
| Allows the usage of custom stickers from other servers. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.SendMessagesInThreads"> | |||
| <summary> | |||
| Allows for sending messages in threads. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermission.StartEmbeddedActivities"> | |||
| <summary> | |||
| Allows for launching activities (applications with the EMBEDDED flag) in a voice channel. | |||
| </summary> | |||
| </member> | |||
| <member name="F:Discord.GuildPermissions.None"> | |||
| <summary> Gets a blank <see cref="T:Discord.GuildPermissions"/> that grants no permissions. </summary> | |||
| </member> | |||
| @@ -8996,7 +9168,7 @@ | |||
| <member name="P:Discord.GuildPermissions.ManageEmojisAndStickers"> | |||
| <summary> If <c>true</c>, a user may edit the emojis and stickers for this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.GuildPermissions.UseSlashCommands"> | |||
| <member name="P:Discord.GuildPermissions.UseApplicationCommands"> | |||
| <summary> If <c>true</c>, a user may use slash commands in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.GuildPermissions.RequestToSpeak"> | |||
| @@ -9005,25 +9177,31 @@ | |||
| <member name="P:Discord.GuildPermissions.ManageThreads"> | |||
| <summary> If <c>true</c>, a user may manage threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.GuildPermissions.UsePublicThreads"> | |||
| <member name="P:Discord.GuildPermissions.CreatePublicThreads"> | |||
| <summary> If <c>true</c>, a user may create public threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.GuildPermissions.UsePrivateThreads"> | |||
| <member name="P:Discord.GuildPermissions.CreatePrivateThreads"> | |||
| <summary> If <c>true</c>, a user may create private threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.GuildPermissions.UseExternalStickers"> | |||
| <summary> If <c>true</c>, a user may use external stickers in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.GuildPermissions.SendMessagesInThreads"> | |||
| <summary> If <c>true</c>, a user may send messages in threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.GuildPermissions.StartEmbeddedActivities"> | |||
| <summary> If <c>true</c>, a user launch application activites in voice channels in this guild. </summary> | |||
| </member> | |||
| <member name="M:Discord.GuildPermissions.#ctor(System.UInt64)"> | |||
| <summary> Creates a new <see cref="T:Discord.GuildPermissions"/> with the provided packed value. </summary> | |||
| </member> | |||
| <member name="M:Discord.GuildPermissions.#ctor(System.String)"> | |||
| <summary> Creates a new <see cref="T:Discord.GuildPermissions"/> with the provided packed value after converting to ulong. </summary> | |||
| </member> | |||
| <member name="M:Discord.GuildPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)"> | |||
| <member name="M:Discord.GuildPermissions.#ctor(System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)"> | |||
| <summary> Creates a new <see cref="T:Discord.GuildPermissions"/> structure with the provided permissions. </summary> | |||
| </member> | |||
| <member name="M:Discord.GuildPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})"> | |||
| <member name="M:Discord.GuildPermissions.Modify(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})"> | |||
| <summary> Creates a new <see cref="T:Discord.GuildPermissions"/> from this one, changing the provided non-null permissions. </summary> | |||
| </member> | |||
| <member name="M:Discord.GuildPermissions.Has(Discord.GuildPermission)"> | |||
| @@ -9164,18 +9342,42 @@ | |||
| <member name="P:Discord.OverwritePermissions.ManageWebhooks"> | |||
| <summary> If True, a user may edit the webhooks for this channel. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.UseApplicationCommands"> | |||
| <summary> If <c>true</c>, a user may use slash commands in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.RequestToSpeak"> | |||
| <summary> If <c>true</c>, a user may request to speak in stage channels. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.ManageThreads"> | |||
| <summary> If <c>true</c>, a user may manage threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.CreatePublicThreads"> | |||
| <summary> If <c>true</c>, a user may create public threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.CreatePrivateThreads"> | |||
| <summary> If <c>true</c>, a user may create private threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.UseExternalStickers"> | |||
| <summary> If <c>true</c>, a user may use external stickers in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.SendMessagesInThreads"> | |||
| <summary> If <c>true</c>, a user may send messages in threads in this guild. </summary> | |||
| </member> | |||
| <member name="P:Discord.OverwritePermissions.StartEmbeddedActivities"> | |||
| <summary> If <c>true</c>, a user launch application activites in voice channels in this guild. </summary> | |||
| </member> | |||
| <member name="M:Discord.OverwritePermissions.#ctor(System.UInt64,System.UInt64)"> | |||
| <summary> Creates a new OverwritePermissions with the provided allow and deny packed values. </summary> | |||
| </member> | |||
| <member name="M:Discord.OverwritePermissions.#ctor(System.String,System.String)"> | |||
| <summary> Creates a new OverwritePermissions with the provided allow and deny packed values after converting to ulong. </summary> | |||
| </member> | |||
| <member name="M:Discord.OverwritePermissions.#ctor(Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue)"> | |||
| <member name="M:Discord.OverwritePermissions.#ctor(Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue,Discord.PermValue)"> | |||
| <summary> | |||
| Initializes a new <see cref="T:Discord.ChannelPermissions"/> struct with the provided permissions. | |||
| </summary> | |||
| </member> | |||
| <member name="M:Discord.OverwritePermissions.Modify(System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue})"> | |||
| <member name="M:Discord.OverwritePermissions.Modify(System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue},System.Nullable{Discord.PermValue})"> | |||
| <summary> | |||
| Initializes a new <see cref="T:Discord.OverwritePermissions" /> from the current one, changing the provided | |||
| non-null permissions. | |||
| @@ -10151,7 +10353,7 @@ | |||
| <example> | |||
| <para>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 <see cref="!:IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference)"/>.</para> | |||
| <code language="cs"> | |||
| <code language="cs"> | |||
| if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) | |||
| await targetChannel.SendFileAsync("fortnite.png"); | |||
| </code> | |||
| @@ -10949,7 +11151,7 @@ | |||
| </code> | |||
| </example> | |||
| <param name="msg">The message to add reactions to.</param> | |||
| <param name="reactions">An array of reactions to add to the message</param> | |||
| <param name="reactions">An array of reactions to add to the message.</param> | |||
| <param name="options">The options to be used when sending the request.</param> | |||
| <returns> | |||
| A task that represents the asynchronous operation for adding a reaction to this message. | |||
| @@ -10971,7 +11173,8 @@ | |||
| </code> | |||
| </example> | |||
| <param name="msg">The message to remove reactions from.</param> | |||
| <param name="reactions">An array of reactions to remove from the message</param> | |||
| <param name="user">The user who removed the reaction.</param> | |||
| <param name="reactions">An array of reactions to remove from the message.</param> | |||
| <param name="options">The options to be used when sending the request.</param> | |||
| <returns> | |||
| A task that represents the asynchronous operation for removing a reaction to this message. | |||
| @@ -10979,18 +11182,22 @@ | |||
| <seealso cref="M:Discord.IMessage.RemoveReactionAsync(Discord.IEmote,Discord.IUser,Discord.RequestOptions)"/> | |||
| <seealso cref="T:Discord.IEmote"/> | |||
| </member> | |||
| <member name="M:Discord.MessageExtensions.ReplyAsync(Discord.IUserMessage,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.ISticker[])"> | |||
| <member name="M:Discord.MessageExtensions.ReplyAsync(Discord.IUserMessage,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||
| <summary> | |||
| Sends an inline reply that references a message. | |||
| </summary> | |||
| <param name="msg">The message that is being replyed on.</param> | |||
| <param name="text">The message to be sent.</param> | |||
| <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | |||
| <param name="embed">The <see cref="F:Discord.EmbedType.Rich"/> <see cref="T:Discord.Embed"/> to be sent.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| <param name="allowedMentions"> | |||
| Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
| If <c>null</c>, all mentioned roles and users will be notified. | |||
| </param> | |||
| <param name="options">The options to be used when sending the request.</param> | |||
| <param name="components">The message components to be included with this message. Used for interactions.</param> | |||
| <param name="stickers">A collection of stickers to send with the message.</param> | |||
| <returns> | |||
| A task that represents an asynchronous send operation for delivering the message. The task result | |||
| contains the sent message. | |||
| @@ -10999,7 +11206,7 @@ | |||
| <member name="T:Discord.UserExtensions"> | |||
| <summary> An extension class for various Discord user objects. </summary> | |||
| </member> | |||
| <member name="M:Discord.UserExtensions.SendMessageAsync(Discord.IUser,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageComponent)"> | |||
| <member name="M:Discord.UserExtensions.SendMessageAsync(Discord.IUser,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageComponent,Discord.Embed[])"> | |||
| <summary> | |||
| Sends a message via DM. | |||
| </summary> | |||
| @@ -11025,11 +11232,13 @@ | |||
| Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
| If <c>null</c>, all mentioned roles and users will be notified. | |||
| </param> | |||
| <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| <returns> | |||
| A task that represents the asynchronous send operation. The task result contains the sent message. | |||
| </returns> | |||
| </member> | |||
| <member name="M:Discord.UserExtensions.SendFileAsync(Discord.IUser,System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.MessageComponent)"> | |||
| <member name="M:Discord.UserExtensions.SendFileAsync(Discord.IUser,System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed[])"> | |||
| <summary> | |||
| Sends a file to this message channel with an optional caption. | |||
| </summary> | |||
| @@ -11066,12 +11275,14 @@ | |||
| <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | |||
| <param name="embed">The <see cref="F:Discord.EmbedType.Rich"/> <see cref="T:Discord.Embed"/> to be sent.</param> | |||
| <param name="options">The options to be used when sending the request.</param> | |||
| <param name="component">The message component to be included with this message. Used for interactions.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| <returns> | |||
| A task that represents an asynchronous send operation for delivering the message. The task result | |||
| contains the sent message. | |||
| </returns> | |||
| </member> | |||
| <member name="M:Discord.UserExtensions.SendFileAsync(Discord.IUser,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.MessageComponent)"> | |||
| <member name="M:Discord.UserExtensions.SendFileAsync(Discord.IUser,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed[])"> | |||
| <summary> | |||
| Sends a file via DM with an optional caption. | |||
| </summary> | |||
| @@ -11113,6 +11324,8 @@ | |||
| <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | |||
| <param name="embed">The <see cref="F:Discord.EmbedType.Rich"/> <see cref="T:Discord.Embed"/> to be sent.</param> | |||
| <param name="options">The options to be used when sending the request.</param> | |||
| <param name="component">The message component to be included with this message. Used for interactions.</param> | |||
| <param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10.</param> | |||
| <returns> | |||
| A task that represents an asynchronous send operation for delivering the message. The task result | |||
| contains the sent message. | |||
| @@ -11707,12 +11920,8 @@ | |||
| <summary> | |||
| Initializes a new instance of the <see cref="T:Discord.Net.ApplicationCommandException" /> class. | |||
| </summary> | |||
| <param name="request">The request that was sent prior to the exception.</param> | |||
| <param name="requestJson"></param> | |||
| <param name="httpError"></param> | |||
| <param name="discordCode">The Discord status code returned.</param> | |||
| <param name="reason">The reason behind the exception.</param> | |||
| <param name="errors"></param> | |||
| </member> | |||
| <member name="T:Discord.Net.BucketId"> | |||
| <summary> | |||
| @@ -12670,7 +12879,7 @@ | |||
| <summary> | |||
| Not full URL validation right now. Just ensures protocol is present and that it's either http or https | |||
| </summary> | |||
| <param name="url">url to validate before sending to Discord</param> | |||
| <param name="url">url to validate before sending to Discord.</param> | |||
| <exception cref="T:System.InvalidOperationException">A URL must include a protocol (http or https).</exception> | |||
| <returns>true if url is valid by our standard, false if null, throws an error upon invalid </returns> | |||
| </member> | |||
| @@ -28,13 +28,14 @@ namespace Discord | |||
| /// If <c>null</c>, all mentioned roles and users will be notified. | |||
| /// </param> | |||
| /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| /// <param name="stickers">A collection of stickers to send with the message.</param> | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| /// <returns> | |||
| /// A task that represents an asynchronous send operation for delivering the message. The task result | |||
| /// contains the sent message. | |||
| /// </returns> | |||
| Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null); | |||
| Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null); | |||
| /// <summary> | |||
| /// Sends a file to this message channel with an optional caption. | |||
| /// </summary> | |||
| @@ -67,13 +68,14 @@ namespace Discord | |||
| /// If <c>null</c>, all mentioned roles and users will be notified. | |||
| /// </param> | |||
| /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| /// <param name="stickers">A collection of stickers to send with the file.</param> | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| /// <returns> | |||
| /// A task that represents an asynchronous send operation for delivering the message. The task result | |||
| /// contains the sent message. | |||
| /// </returns> | |||
| Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null); | |||
| Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null); | |||
| /// <summary> | |||
| /// Sends a file to this message channel with an optional caption. | |||
| /// </summary> | |||
| @@ -103,13 +105,14 @@ namespace Discord | |||
| /// If <c>null</c>, all mentioned roles and users will be notified. | |||
| /// </param> | |||
| /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions</param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| /// <param name="stickers">A collection of stickers to send with the file.</param> | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| /// <returns> | |||
| /// A task that represents an asynchronous send operation for delivering the message. The task result | |||
| /// contains the sent message. | |||
| /// </returns> | |||
| Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null); | |||
| Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null); | |||
| /// <summary> | |||
| /// Gets a message from this message channel. | |||
| @@ -67,7 +67,7 @@ namespace Discord | |||
| /// await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); | |||
| /// </code> | |||
| /// </example> | |||
| /// <param name="applicationId">The id of the embedded application to open for this invite</param> | |||
| /// <param name="applicationId">The id of the embedded application to open for this invite.</param> | |||
| /// <param name="maxAge">The time (in seconds) until the invite expires. Set to <c>null</c> to never expire.</param> | |||
| /// <param name="maxUses">The max amount of times this invite may be used. Set to <c>null</c> to have unlimited uses.</param> | |||
| /// <param name="isTemporary">If <c>true</c>, the user accepting this invite will be kicked from the guild after closing their client.</param> | |||
| @@ -89,7 +89,7 @@ namespace Discord | |||
| /// await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3); | |||
| /// </code> | |||
| /// </example> | |||
| /// <param name="user">The id of the user whose stream to display for this invite</param> | |||
| /// <param name="user">The id of the user whose stream to display for this invite.</param> | |||
| /// <param name="maxAge">The time (in seconds) until the invite expires. Set to <c>null</c> to never expire.</param> | |||
| /// <param name="maxUses">The max amount of times this invite may be used. Set to <c>null</c> to have unlimited uses.</param> | |||
| /// <param name="isTemporary">If <c>true</c>, the user accepting this invite will be kicked from the guild after closing their client.</param> | |||
| @@ -44,7 +44,7 @@ namespace Discord | |||
| /// Starts the stage, creating a stage instance. | |||
| /// </summary> | |||
| /// <param name="topic">The topic for the stage/</param> | |||
| /// <param name="privacyLevel">The privacy level of the stage</param> | |||
| /// <param name="privacyLevel">The privacy level of the stage.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous start operation. | |||
| @@ -1009,7 +1009,7 @@ namespace Discord | |||
| /// <param name="description">The description of the sticker.</param> | |||
| /// <param name="tags">The tags of the sticker.</param> | |||
| /// <param name="stream">The stream containing the file data.</param> | |||
| /// <param name="filename">The name of the file <b>with</b> the extension, ex: image.png</param> | |||
| /// <param name="filename">The name of the file <b>with</b> the extension, ex: image.png.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous creation operation. The task result contains the created sticker. | |||
| @@ -16,7 +16,7 @@ namespace Discord | |||
| private string _description; | |||
| /// <summary> | |||
| /// The name of this option. | |||
| /// Gets or sets the name of this option. | |||
| /// </summary> | |||
| public string Name | |||
| { | |||
| @@ -37,7 +37,7 @@ namespace Discord | |||
| } | |||
| /// <summary> | |||
| /// The description of this option. | |||
| /// Gets or sets the description of this option. | |||
| /// </summary> | |||
| public string Description | |||
| { | |||
| @@ -53,27 +53,31 @@ namespace Discord | |||
| } | |||
| /// <summary> | |||
| /// The type of this option. | |||
| /// Gets or sets the type of this option. | |||
| /// </summary> | |||
| public ApplicationCommandOptionType Type { get; set; } | |||
| /// <summary> | |||
| /// The first required option for the user to complete. only one option can be default. | |||
| /// Gets or sets whether or not this options is the first required option for the user to complete. only one option can be default. | |||
| /// </summary> | |||
| public bool? Default { get; set; } | |||
| /// <summary> | |||
| /// <see langword="true"/> if this option is required for this command, otherwise <see langword="false"/>. | |||
| /// Gets or sets if the option is required. | |||
| /// </summary> | |||
| public bool? Required { get; set; } | |||
| /// <summary> | |||
| /// choices for string and int types for the user to pick from. | |||
| /// Gets or sets whether or not this option supports autocomplete. | |||
| /// </summary> | |||
| public bool Autocomplete { get; set; } | |||
| /// <summary> | |||
| /// Gets or sets the choices for string and int types for the user to pick from. | |||
| /// </summary> | |||
| public List<ApplicationCommandOptionChoiceProperties> Choices { get; set; } | |||
| /// <summary> | |||
| /// If the option is a subcommand or subcommand group type, this nested options will be the parameters. | |||
| /// Gets or sets if this option is a subcommand or subcommand group type, these nested options will be the parameters. | |||
| /// </summary> | |||
| public List<ApplicationCommandOptionProperties> Options { get; set; } | |||
| @@ -0,0 +1,42 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace Discord | |||
| { | |||
| /// <summary> | |||
| /// Represents an autocomplete option. | |||
| /// </summary> | |||
| public class AutocompleteOption | |||
| { | |||
| /// <summary> | |||
| /// Gets the type of this option | |||
| /// </summary> | |||
| public ApplicationCommandOptionType Type { get; } | |||
| /// <summary> | |||
| /// Gets the name of the option. | |||
| /// </summary> | |||
| public string Name { get; } | |||
| /// <summary> | |||
| /// Gets the value of the option. | |||
| /// </summary> | |||
| public object Value { get; } | |||
| /// <summary> | |||
| /// Gets whether or not this option is focused by the executing user. | |||
| /// </summary> | |||
| public bool Focused { get; } | |||
| internal AutocompleteOption(ApplicationCommandOptionType type, string name, object value, bool focused) | |||
| { | |||
| Type = type; | |||
| Name = name; | |||
| Value = value; | |||
| Focused = focused; | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace Discord | |||
| { | |||
| /// <summary> | |||
| /// Represents a result to an autocomplete interaction. | |||
| /// </summary> | |||
| public class AutocompleteResult | |||
| { | |||
| private object _value { get; set; } | |||
| private string _name { get; set; } | |||
| /// <summary> | |||
| /// Gets or sets the name of the result. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Name cannot be null and has to be between 1-100 characters in length. | |||
| /// </remarks> | |||
| /// <exception cref="ArgumentNullException"/> | |||
| /// <exception cref="ArgumentException"/> | |||
| public string Name | |||
| { | |||
| get => _name; | |||
| set | |||
| { | |||
| if (value == null) | |||
| throw new ArgumentException("Name cannot be null!"); | |||
| if (value.Length > 100) | |||
| throw new ArgumentException("Name length must be less than or equal to 100 characters in length!"); | |||
| if (value.Length < 1) | |||
| throw new ArgumentException("Name length must at least 1 character in length!"); | |||
| _name = value; | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Gets or sets the value of the result. | |||
| /// </summary> | |||
| /// <remarks> | |||
| /// Only <see cref="string"/>, <see cref="int"/>, and <see cref="double"/> are allowed for a value. | |||
| /// </remarks> | |||
| /// <exception cref="ArgumentNullException"/> | |||
| /// <exception cref="ArgumentException"/> | |||
| public object Value | |||
| { | |||
| get => _value; | |||
| set | |||
| { | |||
| if (value == null) | |||
| throw new ArgumentNullException("Value cannot be null"); | |||
| _value = value switch | |||
| { | |||
| string str => str, | |||
| int integer => integer, | |||
| long lng => lng, | |||
| double number => number, | |||
| _ => throw new ArgumentException($"Type {value.GetType().Name} cannot be set as a value! Only string, int, and double allowed!"), | |||
| }; | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Creates a new <see cref="AutocompleteResult"/>. | |||
| /// </summary> | |||
| public AutocompleteResult() { } | |||
| /// <summary> | |||
| /// Creates a new <see cref="AutocompleteResult"/> with the passed in <paramref name="name"/> and <paramref name="value"/>. | |||
| /// </summary> | |||
| /// <exception cref="ArgumentNullException"/> | |||
| /// <exception cref="ArgumentException"/> | |||
| public AutocompleteResult(string name, object value) | |||
| { | |||
| Name = name; | |||
| Value = value; | |||
| } | |||
| } | |||
| } | |||
| @@ -53,8 +53,8 @@ namespace Discord | |||
| { | |||
| MessageCommandProperties props = new MessageCommandProperties() | |||
| { | |||
| Name = this.Name, | |||
| DefaultPermission = this.DefaultPermission | |||
| Name = Name, | |||
| DefaultPermission = DefaultPermission | |||
| }; | |||
| return props; | |||
| @@ -70,7 +70,7 @@ namespace Discord | |||
| /// </returns> | |||
| public MessageCommandBuilder WithName(string name) | |||
| { | |||
| this.Name = name; | |||
| Name = name; | |||
| return this; | |||
| } | |||
| @@ -81,7 +81,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public MessageCommandBuilder WithDefaultPermission (bool value) | |||
| { | |||
| this.DefaultPermission = value; | |||
| DefaultPermission = value; | |||
| return this; | |||
| } | |||
| } | |||
| @@ -51,8 +51,8 @@ namespace Discord | |||
| { | |||
| UserCommandProperties props = new UserCommandProperties() | |||
| { | |||
| Name = this.Name, | |||
| DefaultPermission = this.DefaultPermission | |||
| Name = Name, | |||
| DefaultPermission = DefaultPermission | |||
| }; | |||
| return props; | |||
| @@ -68,7 +68,7 @@ namespace Discord | |||
| /// </returns> | |||
| public UserCommandBuilder WithName(string name) | |||
| { | |||
| this.Name = name; | |||
| Name = name; | |||
| return this; | |||
| } | |||
| @@ -79,7 +79,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public UserCommandBuilder WithDefaultPermission (bool value) | |||
| { | |||
| this.DefaultPermission = value; | |||
| DefaultPermission = value; | |||
| return this; | |||
| } | |||
| } | |||
| @@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||
| namespace Discord | |||
| { | |||
| /// <summary> | |||
| /// Options for the <see cref="IApplicationCommand"/>, see <see href="https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption"/>The docs</see>. | |||
| /// Options for the <see cref="IApplicationCommand"/>, see <see href="https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoption">The docs</see>. | |||
| /// </summary> | |||
| public interface IApplicationCommandOption | |||
| { | |||
| @@ -44,12 +44,12 @@ namespace Discord | |||
| /// Responds to an Interaction with type <see cref="InteractionResponseType.ChannelMessageWithSource"/>. | |||
| /// </summary> | |||
| /// <param name="text">The text of the message to be sent.</param> | |||
| /// <param name="embeds">A array of embeds to send with this response. Max 10</param> | |||
| /// <param name="embeds">A array of embeds to send with this response. Max 10.</param> | |||
| /// <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param> | |||
| /// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param> | |||
| /// <param name="allowedMentions">The allowed mentions for this response.</param> | |||
| /// <param name="options">The request options for this response.</param> | |||
| /// <param name="component">A <see cref="MessageComponent"/> to be sent with this response</param> | |||
| /// <param name="component">A <see cref="MessageComponent"/> to be sent with this response.</param> | |||
| /// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param> | |||
| Task RespondAsync (string text = null, Embed[] embeds = null, bool isTTS = false, | |||
| bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null); | |||
| @@ -57,13 +57,13 @@ namespace Discord | |||
| /// <summary> | |||
| /// Sends a followup message for this interaction. | |||
| /// </summary> | |||
| /// <param name="text">The text of the message to be sent</param> | |||
| /// <param name="embeds">A array of embeds to send with this response. Max 10</param> | |||
| /// <param name="text">The text of the message to be sent.</param> | |||
| /// <param name="embeds">A array of embeds to send with this response. Max 10.</param> | |||
| /// <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param> | |||
| /// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param> | |||
| /// <param name="allowedMentions">The allowed mentions for this response.</param> | |||
| /// <param name="options">The request options for this response.</param> | |||
| /// <param name="component">A <see cref="MessageComponent"/> to be sent with this response</param> | |||
| /// <param name="component">A <see cref="MessageComponent"/> to be sent with this response.</param> | |||
| /// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param> | |||
| /// <returns> | |||
| /// The sent message. | |||
| @@ -45,13 +45,18 @@ namespace Discord | |||
| DeferredChannelMessageWithSource = 5, | |||
| /// <summary> | |||
| /// for components: ACK an interaction and edit the original message later; the user does not see a loading state | |||
| /// For components: ACK an interaction and edit the original message later; the user does not see a loading state | |||
| /// </summary> | |||
| DeferredUpdateMessage = 6, | |||
| /// <summary> | |||
| /// for components: edit the message the component was attached to | |||
| /// For components: edit the message the component was attached to | |||
| /// </summary> | |||
| UpdateMessage = 7 | |||
| UpdateMessage = 7, | |||
| /// <summary> | |||
| /// Respond with a set of choices to a autocomplete interaction | |||
| /// </summary> | |||
| ApplicationCommandAutocompleteResult = 8 | |||
| } | |||
| } | |||
| @@ -25,5 +25,10 @@ namespace Discord | |||
| /// A <see cref="IMessageComponent"/> sent from discord. | |||
| /// </summary> | |||
| MessageComponent = 3, | |||
| /// <summary> | |||
| /// An autocomplete request sent from discord. | |||
| /// </summary> | |||
| ApplicationCommandAutocomplete = 4, | |||
| } | |||
| } | |||
| @@ -25,7 +25,7 @@ namespace Discord | |||
| internal ActionRowComponent() { } | |||
| internal ActionRowComponent(List<IMessageComponent> components) | |||
| { | |||
| this.Components = components; | |||
| Components = components; | |||
| } | |||
| string IMessageComponent.CustomId => null; | |||
| @@ -55,16 +55,16 @@ namespace Discord | |||
| /// A newly created button builder with the same properties as this button. | |||
| /// </returns> | |||
| public ButtonBuilder ToBuilder() | |||
| => new ButtonBuilder(this.Label, this.CustomId, this.Style, this.Url, this.Emote, this.Disabled); | |||
| => new ButtonBuilder(Label, CustomId, Style, Url, Emote, Disabled); | |||
| internal ButtonComponent(ButtonStyle style, string label, IEmote emote, string customId, string url, bool disabled) | |||
| { | |||
| this.Style = style; | |||
| this.Label = label; | |||
| this.Emote = emote; | |||
| this.CustomId = customId; | |||
| this.Url = url; | |||
| this.Disabled = disabled; | |||
| Style = style; | |||
| Label = label; | |||
| Emote = emote; | |||
| CustomId = customId; | |||
| Url = url; | |||
| Disabled = disabled; | |||
| } | |||
| } | |||
| } | |||
| @@ -69,14 +69,14 @@ namespace Discord | |||
| switch (component) | |||
| { | |||
| case ButtonComponent button: | |||
| this.WithButton(button.Label, button.CustomId, button.Style, button.Emote, button.Url, button.Disabled, row); | |||
| WithButton(button.Label, button.CustomId, button.Style, button.Emote, button.Url, button.Disabled, row); | |||
| break; | |||
| case ActionRowComponent actionRow: | |||
| foreach (var cmp in actionRow.Components) | |||
| AddComponent(cmp, row); | |||
| break; | |||
| case SelectMenuComponent menu: | |||
| this.WithSelectMenu(menu.Placeholder, menu.CustomId, menu.Options.Select(x => new SelectMenuOptionBuilder(x.Label, x.Value, x.Description, x.Emote, x.Default)).ToList(), menu.Placeholder, menu.MinValues, menu.MaxValues, menu.Disabled, row); | |||
| WithSelectMenu(menu.Placeholder, menu.CustomId, menu.Options.Select(x => new SelectMenuOptionBuilder(x.Label, x.Value, x.Description, x.Emote, x.Default)).ToList(), menu.Placeholder, menu.MinValues, menu.MaxValues, menu.Disabled, row); | |||
| break; | |||
| } | |||
| } | |||
| @@ -187,7 +187,7 @@ namespace Discord | |||
| .WithUrl(url) | |||
| .WithDisabled(disabled); | |||
| return this.WithButton(button, row); | |||
| return WithButton(button, row); | |||
| } | |||
| /// <summary> | |||
| @@ -207,8 +207,10 @@ namespace Discord | |||
| if (_actionRows == null) | |||
| { | |||
| _actionRows = new List<ActionRowBuilder>(); | |||
| _actionRows.Add(new ActionRowBuilder().AddComponent(builtButton)); | |||
| _actionRows = new List<ActionRowBuilder> | |||
| { | |||
| new ActionRowBuilder().AddComponent(builtButton) | |||
| }; | |||
| } | |||
| else | |||
| { | |||
| @@ -240,11 +242,11 @@ namespace Discord | |||
| /// <summary> | |||
| /// Builds this builder into a <see cref="MessageComponent"/> used to send your components. | |||
| /// </summary> | |||
| /// <returns>A <see cref="MessageComponent"/> that can be sent with <see cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent)"/>.</returns> | |||
| /// <returns>A <see cref="MessageComponent"/> that can be sent with <see cref="IMessageChannel.SendMessageAsync"/>.</returns> | |||
| public MessageComponent Build() | |||
| { | |||
| if (this._actionRows != null) | |||
| return new MessageComponent(this._actionRows.Select(x => x.Build()).ToList()); | |||
| if (_actionRows != null) | |||
| return new MessageComponent(_actionRows.Select(x => x.Build()).ToList()); | |||
| else | |||
| return MessageComponent.Empty; | |||
| } | |||
| @@ -293,7 +295,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public ActionRowBuilder WithComponents(List<IMessageComponent> components) | |||
| { | |||
| this.Components = components; | |||
| Components = components; | |||
| return this; | |||
| } | |||
| @@ -305,10 +307,10 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public ActionRowBuilder AddComponent(IMessageComponent component) | |||
| { | |||
| if (this.Components.Count >= MaxChildCount) | |||
| if (Components.Count >= MaxChildCount) | |||
| throw new InvalidOperationException($"Components count reached {MaxChildCount}"); | |||
| this.Components.Add(component); | |||
| Components.Add(component); | |||
| return this; | |||
| } | |||
| @@ -318,7 +320,7 @@ namespace Discord | |||
| /// <returns>A <see cref="ActionRowComponent"/> that can be used within a <see cref="ComponentBuilder"/></returns> | |||
| public ActionRowComponent Build() | |||
| { | |||
| return new ActionRowComponent(this._components); | |||
| return new ActionRowComponent(_components); | |||
| } | |||
| internal bool CanTakeComponent(IMessageComponent component) | |||
| @@ -328,12 +330,12 @@ namespace Discord | |||
| case ComponentType.ActionRow: | |||
| return false; | |||
| case ComponentType.Button: | |||
| if (this.Components.Any(x => x.Type == ComponentType.SelectMenu)) | |||
| if (Components.Any(x => x.Type == ComponentType.SelectMenu)) | |||
| return false; | |||
| else | |||
| return this.Components.Count < 5; | |||
| return Components.Count < 5; | |||
| case ComponentType.SelectMenu: | |||
| return this.Components.Count == 0; | |||
| return Components.Count == 0; | |||
| default: | |||
| return false; | |||
| } | |||
| @@ -427,18 +429,18 @@ namespace Discord | |||
| /// </summary> | |||
| /// <param name="label">The label to use on the newly created link button.</param> | |||
| /// <param name="url">The url of this button.</param> | |||
| /// <param name="customId">The custom ID of this button</param> | |||
| /// <param name="style">The custom ID of this button</param> | |||
| /// <param name="emote">The emote of this button</param> | |||
| /// <param name="disabled">Disabled this button or not</param> | |||
| /// <param name="customId">The custom ID of this button.</param> | |||
| /// <param name="style">The custom ID of this button.</param> | |||
| /// <param name="emote">The emote of this button.</param> | |||
| /// <param name="disabled">Disabled this button or not.</param> | |||
| public ButtonBuilder(string label = null, string customId = null, ButtonStyle style = ButtonStyle.Primary, string url = null, IEmote emote = null, bool disabled = false) | |||
| { | |||
| this.CustomId = customId; | |||
| this.Style = style; | |||
| this.Url = url; | |||
| this.Label = label; | |||
| this.Disabled = disabled; | |||
| this.Emote = emote; | |||
| CustomId = customId; | |||
| Style = style; | |||
| Url = url; | |||
| Label = label; | |||
| Disabled = disabled; | |||
| Emote = emote; | |||
| } | |||
| /// <summary> | |||
| @@ -446,12 +448,12 @@ namespace Discord | |||
| /// </summary> | |||
| public ButtonBuilder(ButtonComponent button) | |||
| { | |||
| this.CustomId = button.CustomId; | |||
| this.Style = button.Style; | |||
| this.Url = button.Url; | |||
| this.Label = button.Label; | |||
| this.Disabled = button.Disabled; | |||
| this.Emote = button.Emote; | |||
| CustomId = button.CustomId; | |||
| Style = button.Style; | |||
| Url = button.Url; | |||
| Label = button.Label; | |||
| Disabled = button.Disabled; | |||
| Emote = button.Emote; | |||
| } | |||
| /// <summary> | |||
| @@ -459,7 +461,7 @@ namespace Discord | |||
| /// </summary> | |||
| /// <param name="label">The label for this link button.</param> | |||
| /// <param name="url">The url for this link button to go to.</param> | |||
| /// <param name="emote">The emote for this link button</param> | |||
| /// <param name="emote">The emote for this link button.</param> | |||
| /// <returns>A builder with the newly created button.</returns> | |||
| public static ButtonBuilder CreateLinkButton(string label, string url, IEmote emote = null) | |||
| => new ButtonBuilder(label, null, ButtonStyle.Link, url, emote: emote); | |||
| @@ -469,7 +471,7 @@ namespace Discord | |||
| /// </summary> | |||
| /// <param name="label">The label for this danger button.</param> | |||
| /// <param name="customId">The custom id for this danger button.</param> | |||
| /// <param name="emote">The emote for this danger button</param> | |||
| /// <param name="emote">The emote for this danger button.</param> | |||
| /// <returns>A builder with the newly created button.</returns> | |||
| public static ButtonBuilder CreateDangerButton(string label, string customId, IEmote emote = null) | |||
| => new ButtonBuilder(label, customId, ButtonStyle.Danger, emote: emote); | |||
| @@ -479,7 +481,7 @@ namespace Discord | |||
| /// </summary> | |||
| /// <param name="label">The label for this primary button.</param> | |||
| /// <param name="customId">The custom id for this primary button.</param> | |||
| /// <param name="emote">The emote for this primary button</param> | |||
| /// <param name="emote">The emote for this primary button.</param> | |||
| /// <returns>A builder with the newly created button.</returns> | |||
| public static ButtonBuilder CreatePrimaryButton(string label, string customId, IEmote emote = null) | |||
| => new ButtonBuilder(label, customId, emote: emote); | |||
| @@ -489,7 +491,7 @@ namespace Discord | |||
| /// </summary> | |||
| /// <param name="label">The label for this secondary button.</param> | |||
| /// <param name="customId">The custom id for this secondary button.</param> | |||
| /// <param name="emote">The emote for this secondary button</param> | |||
| /// <param name="emote">The emote for this secondary button.</param> | |||
| /// <returns>A builder with the newly created button.</returns> | |||
| public static ButtonBuilder CreateSecondaryButton(string label, string customId, IEmote emote = null) | |||
| => new ButtonBuilder(label, customId, ButtonStyle.Secondary, emote: emote); | |||
| @@ -499,7 +501,7 @@ namespace Discord | |||
| /// </summary> | |||
| /// <param name="label">The label for this success button.</param> | |||
| /// <param name="customId">The custom id for this success button.</param> | |||
| /// <param name="emote">The emote for this success button</param> | |||
| /// <param name="emote">The emote for this success button.</param> | |||
| /// <returns>A builder with the newly created button.</returns> | |||
| public static ButtonBuilder CreateSuccessButton(string label, string customId, IEmote emote = null) | |||
| => new ButtonBuilder(label, customId, ButtonStyle.Success, emote: emote); | |||
| @@ -507,12 +509,12 @@ namespace Discord | |||
| /// <summary> | |||
| /// Sets the current buttons label to the specified text. | |||
| /// </summary> | |||
| /// <param name="label">The text for the label</param> | |||
| /// <param name="label">The text for the label.</param> | |||
| /// <inheritdoc cref="Label"/> | |||
| /// <returns>The current builder.</returns> | |||
| public ButtonBuilder WithLabel(string label) | |||
| { | |||
| this.Label = label; | |||
| Label = label; | |||
| return this; | |||
| } | |||
| @@ -523,7 +525,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public ButtonBuilder WithStyle(ButtonStyle style) | |||
| { | |||
| this.Style = style; | |||
| Style = style; | |||
| return this; | |||
| } | |||
| @@ -534,7 +536,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public ButtonBuilder WithEmote(IEmote emote) | |||
| { | |||
| this.Emote = emote; | |||
| Emote = emote; | |||
| return this; | |||
| } | |||
| @@ -545,7 +547,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public ButtonBuilder WithUrl(string url) | |||
| { | |||
| this.Url = url; | |||
| Url = url; | |||
| return this; | |||
| } | |||
| @@ -557,7 +559,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public ButtonBuilder WithCustomId(string id) | |||
| { | |||
| this.CustomId = id; | |||
| CustomId = id; | |||
| return this; | |||
| } | |||
| @@ -568,7 +570,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public ButtonBuilder WithDisabled(bool disabled) | |||
| { | |||
| this.Disabled = disabled; | |||
| Disabled = disabled; | |||
| return this; | |||
| } | |||
| @@ -583,23 +585,23 @@ namespace Discord | |||
| /// <exception cref="InvalidOperationException">A non-link button must contain a custom id</exception> | |||
| public ButtonComponent Build() | |||
| { | |||
| if (string.IsNullOrEmpty(this.Label) && this.Emote == null) | |||
| if (string.IsNullOrEmpty(Label) && Emote == null) | |||
| throw new InvalidOperationException("A button must have an Emote or a label!"); | |||
| if (!(string.IsNullOrEmpty(this.Url) ^ string.IsNullOrEmpty(this.CustomId))) | |||
| if (!(string.IsNullOrEmpty(Url) ^ string.IsNullOrEmpty(CustomId))) | |||
| throw new InvalidOperationException("A button must contain either a URL or a CustomId, but not both!"); | |||
| if (this.Style == ButtonStyle.Link) | |||
| if (Style == ButtonStyle.Link) | |||
| { | |||
| if (string.IsNullOrEmpty(this.Url)) | |||
| if (string.IsNullOrEmpty(Url)) | |||
| throw new InvalidOperationException("Link buttons must have a link associated with them"); | |||
| else | |||
| UrlValidation.Validate(this.Url); | |||
| UrlValidation.Validate(Url); | |||
| } | |||
| else if (string.IsNullOrEmpty(this.CustomId)) | |||
| else if (string.IsNullOrEmpty(CustomId)) | |||
| throw new InvalidOperationException("Non-link buttons must have a custom id associated with them"); | |||
| return new ButtonComponent(this.Style, this.Label, this.Emote, this.CustomId, this.Url, this.Disabled); | |||
| return new ButtonComponent(Style, Label, Emote, CustomId, Url, Disabled); | |||
| } | |||
| } | |||
| @@ -734,12 +736,12 @@ namespace Discord | |||
| /// </summary> | |||
| public SelectMenuBuilder(SelectMenuComponent selectMenu) | |||
| { | |||
| this.Placeholder = selectMenu.Placeholder; | |||
| this.CustomId = selectMenu.Placeholder; | |||
| this.MaxValues = selectMenu.MaxValues; | |||
| this.MinValues = selectMenu.MinValues; | |||
| this.Disabled = selectMenu.Disabled; | |||
| this.Options = selectMenu.Options? | |||
| Placeholder = selectMenu.Placeholder; | |||
| CustomId = selectMenu.Placeholder; | |||
| MaxValues = selectMenu.MaxValues; | |||
| MinValues = selectMenu.MinValues; | |||
| Disabled = selectMenu.Disabled; | |||
| Options = selectMenu.Options? | |||
| .Select(x => new SelectMenuOptionBuilder(x.Label, x.Value, x.Description, x.Emote, x.Default)) | |||
| .ToList(); | |||
| } | |||
| @@ -755,12 +757,12 @@ namespace Discord | |||
| /// <param name="disabled">Disabled this select menu or not.</param> | |||
| public SelectMenuBuilder(string customId, List<SelectMenuOptionBuilder> options, string placeholder = null, int maxValues = 1, int minValues = 1, bool disabled = false) | |||
| { | |||
| this.CustomId = customId; | |||
| this.Options = options; | |||
| this.Placeholder = placeholder; | |||
| this.Disabled = disabled; | |||
| this.MaxValues = maxValues; | |||
| this.MinValues = minValues; | |||
| CustomId = customId; | |||
| Options = options; | |||
| Placeholder = placeholder; | |||
| Disabled = disabled; | |||
| MaxValues = maxValues; | |||
| MinValues = minValues; | |||
| } | |||
| /// <summary> | |||
| @@ -773,7 +775,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder WithCustomId(string customId) | |||
| { | |||
| this.CustomId = customId; | |||
| CustomId = customId; | |||
| return this; | |||
| } | |||
| @@ -787,7 +789,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder WithPlaceholder(string placeholder) | |||
| { | |||
| this.Placeholder = placeholder; | |||
| Placeholder = placeholder; | |||
| return this; | |||
| } | |||
| @@ -801,7 +803,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder WithMinValues(int minValues) | |||
| { | |||
| this.MinValues = minValues; | |||
| MinValues = minValues; | |||
| return this; | |||
| } | |||
| @@ -815,7 +817,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder WithMaxValues(int maxValues) | |||
| { | |||
| this.MaxValues = maxValues; | |||
| MaxValues = maxValues; | |||
| return this; | |||
| } | |||
| @@ -829,7 +831,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder WithOptions(List<SelectMenuOptionBuilder> options) | |||
| { | |||
| this.Options = options; | |||
| Options = options; | |||
| return this; | |||
| } | |||
| @@ -843,10 +845,10 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder AddOption(SelectMenuOptionBuilder option) | |||
| { | |||
| if (this.Options.Count >= MaxOptionCount) | |||
| if (Options.Count >= MaxOptionCount) | |||
| throw new InvalidOperationException($"Options count reached {MaxOptionCount}."); | |||
| this.Options.Add(option); | |||
| Options.Add(option); | |||
| return this; | |||
| } | |||
| @@ -877,7 +879,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder WithDisabled(bool disabled) | |||
| { | |||
| this.Disabled = disabled; | |||
| Disabled = disabled; | |||
| return this; | |||
| } | |||
| @@ -887,9 +889,9 @@ namespace Discord | |||
| /// <returns>The newly built <see cref="SelectMenuComponent"/></returns> | |||
| public SelectMenuComponent Build() | |||
| { | |||
| var options = this.Options?.Select(x => x.Build()).ToList(); | |||
| var options = Options?.Select(x => x.Build()).ToList(); | |||
| return new SelectMenuComponent(this.CustomId, options, this.Placeholder, this.MinValues, this.MaxValues, this.Disabled); | |||
| return new SelectMenuComponent(CustomId, options, Placeholder, MinValues, MaxValues, Disabled); | |||
| } | |||
| } | |||
| @@ -1010,11 +1012,11 @@ namespace Discord | |||
| /// <param name="default">Render this option as selected by default or not.</param> | |||
| public SelectMenuOptionBuilder(string label, string value, string description = null, IEmote emote = null, bool? @default = null) | |||
| { | |||
| this.Label = label; | |||
| this.Value = value; | |||
| this.Description = description; | |||
| this.Emote = emote; | |||
| this.Default = @default; | |||
| Label = label; | |||
| Value = value; | |||
| Description = description; | |||
| Emote = emote; | |||
| Default = @default; | |||
| } | |||
| /// <summary> | |||
| @@ -1022,11 +1024,11 @@ namespace Discord | |||
| /// </summary> | |||
| public SelectMenuOptionBuilder(SelectMenuOption option) | |||
| { | |||
| this.Label = option.Label; | |||
| this.Value = option.Value; | |||
| this.Description = option.Description; | |||
| this.Emote = option.Emote; | |||
| this.Default = option.Default; | |||
| Label = option.Label; | |||
| Value = option.Value; | |||
| Description = option.Description; | |||
| Emote = option.Emote; | |||
| Default = option.Default; | |||
| } | |||
| /// <summary> | |||
| @@ -1039,7 +1041,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuOptionBuilder WithLabel(string label) | |||
| { | |||
| this.Label = label; | |||
| Label = label; | |||
| return this; | |||
| } | |||
| @@ -1053,7 +1055,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuOptionBuilder WithValue(string value) | |||
| { | |||
| this.Value = value; | |||
| Value = value; | |||
| return this; | |||
| } | |||
| @@ -1067,7 +1069,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuOptionBuilder WithDescription(string description) | |||
| { | |||
| this.Description = description; | |||
| Description = description; | |||
| return this; | |||
| } | |||
| @@ -1080,7 +1082,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuOptionBuilder WithEmote(IEmote emote) | |||
| { | |||
| this.Emote = emote; | |||
| Emote = emote; | |||
| return this; | |||
| } | |||
| @@ -1093,7 +1095,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuOptionBuilder WithDefault(bool defaultValue) | |||
| { | |||
| this.Default = defaultValue; | |||
| Default = defaultValue; | |||
| return this; | |||
| } | |||
| @@ -1103,7 +1105,7 @@ namespace Discord | |||
| /// <returns>The newly built <see cref="SelectMenuOption"/>.</returns> | |||
| public SelectMenuOption Build() | |||
| { | |||
| return new SelectMenuOption(this.Label, this.Value, this.Description, this.Emote, this.Default); | |||
| return new SelectMenuOption(Label, Value, Description, Emote, Default); | |||
| } | |||
| } | |||
| } | |||
| @@ -18,7 +18,7 @@ namespace Discord | |||
| internal MessageComponent(List<ActionRowComponent> components) | |||
| { | |||
| this.Components = components; | |||
| Components = components; | |||
| } | |||
| /// <summary> | |||
| @@ -52,21 +52,21 @@ namespace Discord | |||
| /// </returns> | |||
| public SelectMenuBuilder ToBuilder() | |||
| => new SelectMenuBuilder( | |||
| this.CustomId, | |||
| this.Options.Select(x => new SelectMenuOptionBuilder(x.Label, x.Value, x.Description, x.Emote, x.Default)).ToList(), | |||
| this.Placeholder, | |||
| this.MaxValues, | |||
| this.MinValues, | |||
| this.Disabled); | |||
| CustomId, | |||
| Options.Select(x => new SelectMenuOptionBuilder(x.Label, x.Value, x.Description, x.Emote, x.Default)).ToList(), | |||
| Placeholder, | |||
| MaxValues, | |||
| MinValues, | |||
| Disabled); | |||
| internal SelectMenuComponent(string customId, List<SelectMenuOption> options, string placeholder, int minValues, int maxValues, bool disabled) | |||
| { | |||
| this.CustomId = customId; | |||
| this.Options = options; | |||
| this.Placeholder = placeholder; | |||
| this.MinValues = minValues; | |||
| this.MaxValues = maxValues; | |||
| this.Disabled = disabled; | |||
| CustomId = customId; | |||
| Options = options; | |||
| Placeholder = placeholder; | |||
| MinValues = minValues; | |||
| MaxValues = maxValues; | |||
| Disabled = disabled; | |||
| } | |||
| } | |||
| } | |||
| @@ -38,11 +38,11 @@ namespace Discord | |||
| internal SelectMenuOption(string label, string value, string description, IEmote emote, bool? defaultValue) | |||
| { | |||
| this.Label = label; | |||
| this.Value = value; | |||
| this.Description = description; | |||
| this.Emote = emote; | |||
| this.Default = defaultValue; | |||
| Label = label; | |||
| Value = value; | |||
| Description = description; | |||
| Emote = emote; | |||
| Default = defaultValue; | |||
| } | |||
| } | |||
| } | |||
| @@ -100,16 +100,16 @@ namespace Discord | |||
| { | |||
| SlashCommandProperties props = new SlashCommandProperties() | |||
| { | |||
| Name = this.Name, | |||
| Description = this.Description, | |||
| DefaultPermission = this.DefaultPermission, | |||
| Name = Name, | |||
| Description = Description, | |||
| DefaultPermission = DefaultPermission, | |||
| }; | |||
| if (this.Options != null && this.Options.Any()) | |||
| if (Options != null && Options.Any()) | |||
| { | |||
| var options = new List<ApplicationCommandOptionProperties>(); | |||
| this.Options.ForEach(x => options.Add(x.Build())); | |||
| Options.ForEach(x => options.Add(x.Build())); | |||
| props.Options = options; | |||
| } | |||
| @@ -127,7 +127,7 @@ namespace Discord | |||
| /// </returns> | |||
| public SlashCommandBuilder WithName(string name) | |||
| { | |||
| this.Name = name; | |||
| Name = name; | |||
| return this; | |||
| } | |||
| @@ -138,7 +138,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandBuilder WithDescription(string description) | |||
| { | |||
| this.Description = description; | |||
| Description = description; | |||
| return this; | |||
| } | |||
| @@ -149,7 +149,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandBuilder WithDefaultPermission(bool value) | |||
| { | |||
| this.DefaultPermission = value; | |||
| DefaultPermission = value; | |||
| return this; | |||
| } | |||
| @@ -161,11 +161,12 @@ namespace Discord | |||
| /// <param name="description">The description of this option.</param> | |||
| /// <param name="required">If this option is required for this command.</param> | |||
| /// <param name="isDefault">If this option is the default option.</param> | |||
| /// <param name="isAutocomplete">If this option is set to autocompleate.</param> | |||
| /// <param name="options">The options of the option to add.</param> | |||
| /// <param name="choices">The choices of this option.</param> | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandBuilder AddOption(string name, ApplicationCommandOptionType type, | |||
| string description, bool required = true, bool isDefault = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices) | |||
| string description, bool? required = null, bool? isDefault = null, bool isAutocomplete = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices) | |||
| { | |||
| // Make sure the name matches the requirements from discord | |||
| Preconditions.NotNullOrEmpty(name, nameof(name)); | |||
| @@ -183,21 +184,24 @@ namespace Discord | |||
| Preconditions.AtMost(description.Length, MaxDescriptionLength, nameof(description)); | |||
| // make sure theres only one option with default set to true | |||
| if (isDefault) | |||
| if (isDefault.HasValue && isDefault.Value) | |||
| { | |||
| if (this.Options != null) | |||
| if (this.Options.Any(x => x.Default.HasValue && x.Default.Value)) | |||
| if (Options != null) | |||
| if (Options.Any(x => x.Default.HasValue && x.Default.Value)) | |||
| throw new ArgumentException("There can only be one command option with default set to true!", nameof(isDefault)); | |||
| } | |||
| SlashCommandOptionBuilder option = new SlashCommandOptionBuilder(); | |||
| option.Name = name; | |||
| option.Description = description; | |||
| option.Required = required; | |||
| option.Default = isDefault; | |||
| option.Options = options; | |||
| option.Type = type; | |||
| option.Choices = choices != null ? new List<ApplicationCommandOptionChoiceProperties>(choices) : null; | |||
| SlashCommandOptionBuilder option = new SlashCommandOptionBuilder | |||
| { | |||
| Name = name, | |||
| Description = description, | |||
| Required = required, | |||
| Default = isDefault, | |||
| Options = options, | |||
| Type = type, | |||
| Autocomplete = isAutocomplete, | |||
| Choices = choices != null ? new List<ApplicationCommandOptionChoiceProperties>(choices) : null | |||
| }; | |||
| return AddOption(option); | |||
| } | |||
| @@ -233,16 +237,16 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandBuilder AddOption(SlashCommandOptionBuilder option) | |||
| { | |||
| if (this.Options == null) | |||
| this.Options = new List<SlashCommandOptionBuilder>(); | |||
| if (Options == null) | |||
| Options = new List<SlashCommandOptionBuilder>(); | |||
| if (this.Options.Count >= MaxOptionsCount) | |||
| if (Options.Count >= MaxOptionsCount) | |||
| throw new ArgumentOutOfRangeException(nameof(Options), $"Cannot have more than {MaxOptionsCount} options!"); | |||
| if (option == null) | |||
| throw new ArgumentNullException(nameof(option), "Option cannot be null"); | |||
| this.Options.Add(option); | |||
| Options.Add(option); | |||
| return this; | |||
| } | |||
| /// <summary> | |||
| @@ -258,13 +262,13 @@ namespace Discord | |||
| if (options.Length == 0) | |||
| throw new ArgumentException(nameof(options), "Options cannot be empty!"); | |||
| if (this.Options == null) | |||
| this.Options = new List<SlashCommandOptionBuilder>(); | |||
| if (Options == null) | |||
| Options = new List<SlashCommandOptionBuilder>(); | |||
| if (this.Options.Count + options.Length > MaxOptionsCount) | |||
| if (Options.Count + options.Length > MaxOptionsCount) | |||
| throw new ArgumentOutOfRangeException(nameof(options), $"Cannot have more than {MaxOptionsCount} options!"); | |||
| this.Options.AddRange(options); | |||
| Options.AddRange(options); | |||
| return this; | |||
| } | |||
| } | |||
| @@ -288,7 +292,7 @@ namespace Discord | |||
| private string _description; | |||
| /// <summary> | |||
| /// The name of this option. | |||
| /// Gets or sets the name of this option. | |||
| /// </summary> | |||
| public string Name | |||
| { | |||
| @@ -309,7 +313,7 @@ namespace Discord | |||
| } | |||
| /// <summary> | |||
| /// The description of this option. | |||
| /// Gets or sets the description of this option. | |||
| /// </summary> | |||
| public string Description | |||
| { | |||
| @@ -326,27 +330,32 @@ namespace Discord | |||
| } | |||
| /// <summary> | |||
| /// The type of this option. | |||
| /// Gets or sets the type of this option. | |||
| /// </summary> | |||
| public ApplicationCommandOptionType Type { get; set; } | |||
| /// <summary> | |||
| /// The first required option for the user to complete. only one option can be default. | |||
| /// Gets or sets whether or not this options is the first required option for the user to complete. only one option can be default. | |||
| /// </summary> | |||
| public bool? Default { get; set; } | |||
| /// <summary> | |||
| /// <see langword="true"/> if this option is required for this command, otherwise <see langword="false"/>. | |||
| /// Gets or sets if the option is required. | |||
| /// </summary> | |||
| public bool Required { get; set; } | |||
| public bool? Required { get; set; } = null; | |||
| /// <summary> | |||
| /// choices for string and int types for the user to pick from. | |||
| /// Gets or sets whether or not this option supports autocomplete. | |||
| /// </summary> | |||
| public bool Autocomplete { get; set; } | |||
| /// <summary> | |||
| /// Gets or sets the choices for string and int types for the user to pick from. | |||
| /// </summary> | |||
| public List<ApplicationCommandOptionChoiceProperties> Choices { get; set; } | |||
| /// <summary> | |||
| /// If the option is a subcommand or subcommand group type, this nested options will be the parameters. | |||
| /// Gets or sets if this option is a subcommand or subcommand group type, these nested options will be the parameters. | |||
| /// </summary> | |||
| public List<SlashCommandOptionBuilder> Options { get; set; } | |||
| @@ -356,7 +365,7 @@ namespace Discord | |||
| /// <returns>The built version of this option.</returns> | |||
| public ApplicationCommandOptionProperties Build() | |||
| { | |||
| bool isSubType = this.Type == ApplicationCommandOptionType.SubCommandGroup; | |||
| bool isSubType = Type == ApplicationCommandOptionType.SubCommandGroup; | |||
| if (isSubType && (Options == null || !Options.Any())) | |||
| throw new ArgumentException(nameof(Options), "SubCommands/SubCommandGroups must have at least one option"); | |||
| @@ -366,13 +375,14 @@ namespace Discord | |||
| return new ApplicationCommandOptionProperties() | |||
| { | |||
| Name = this.Name, | |||
| Description = this.Description, | |||
| Default = this.Default, | |||
| Required = this.Required, | |||
| Type = this.Type, | |||
| Options = this.Options?.Count > 0 ? new List<ApplicationCommandOptionProperties>(this.Options.Select(x => x.Build())) : null, | |||
| Choices = this.Choices | |||
| Name = Name, | |||
| Description = Description, | |||
| Default = Default, | |||
| Required = Required, | |||
| Type = Type, | |||
| Options = Options?.Count > 0 ? new List<ApplicationCommandOptionProperties>(Options.Select(x => x.Build())) : null, | |||
| Choices = Choices, | |||
| Autocomplete = Autocomplete | |||
| }; | |||
| } | |||
| @@ -388,7 +398,7 @@ namespace Discord | |||
| /// <param name="choices">The choices of this option.</param> | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandOptionBuilder AddOption(string name, ApplicationCommandOptionType type, | |||
| string description, bool required = true, bool isDefault = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices) | |||
| string description, bool? required = null, bool isDefault = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices) | |||
| { | |||
| // Make sure the name matches the requirements from discord | |||
| Preconditions.NotNullOrEmpty(name, nameof(name)); | |||
| @@ -408,19 +418,21 @@ namespace Discord | |||
| // make sure theres only one option with default set to true | |||
| if (isDefault) | |||
| { | |||
| if (this.Options != null) | |||
| if (this.Options.Any(x => x.Default.HasValue && x.Default.Value)) | |||
| if (Options != null) | |||
| if (Options.Any(x => x.Default.HasValue && x.Default.Value)) | |||
| throw new ArgumentException("There can only be one command option with default set to true!", nameof(isDefault)); | |||
| } | |||
| SlashCommandOptionBuilder option = new SlashCommandOptionBuilder(); | |||
| option.Name = name; | |||
| option.Description = description; | |||
| option.Required = required; | |||
| option.Default = isDefault; | |||
| option.Options = options; | |||
| option.Type = type; | |||
| option.Choices = choices != null ? new List<ApplicationCommandOptionChoiceProperties>(choices) : null; | |||
| SlashCommandOptionBuilder option = new SlashCommandOptionBuilder | |||
| { | |||
| Name = name, | |||
| Description = description, | |||
| Required = required, | |||
| Default = isDefault, | |||
| Options = options, | |||
| Type = type, | |||
| Choices = choices != null ? new List<ApplicationCommandOptionChoiceProperties>(choices) : null | |||
| }; | |||
| return AddOption(option); | |||
| } | |||
| @@ -431,10 +443,10 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandOptionBuilder AddOption(SlashCommandOptionBuilder option) | |||
| { | |||
| if (this.Options == null) | |||
| this.Options = new List<SlashCommandOptionBuilder>(); | |||
| if (Options == null) | |||
| Options = new List<SlashCommandOptionBuilder>(); | |||
| if (this.Options.Count >= SlashCommandBuilder.MaxOptionsCount) | |||
| if (Options.Count >= SlashCommandBuilder.MaxOptionsCount) | |||
| throw new ArgumentOutOfRangeException(nameof(Choices), $"There can only be {SlashCommandBuilder.MaxOptionsCount} options per sub command group!"); | |||
| if (option == null) | |||
| @@ -515,7 +527,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandOptionBuilder WithName(string name) | |||
| { | |||
| this.Name = name; | |||
| Name = name; | |||
| return this; | |||
| } | |||
| @@ -527,7 +539,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandOptionBuilder WithDescription(string description) | |||
| { | |||
| this.Description = description; | |||
| Description = description; | |||
| return this; | |||
| } | |||
| @@ -538,7 +550,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandOptionBuilder WithRequired(bool value) | |||
| { | |||
| this.Required = value; | |||
| Required = value; | |||
| return this; | |||
| } | |||
| @@ -549,7 +561,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandOptionBuilder WithDefault(bool value) | |||
| { | |||
| this.Default = value; | |||
| Default = value; | |||
| return this; | |||
| } | |||
| @@ -560,7 +572,7 @@ namespace Discord | |||
| /// <returns>The current builder.</returns> | |||
| public SlashCommandOptionBuilder WithType(ApplicationCommandOptionType type) | |||
| { | |||
| this.Type = type; | |||
| Type = type; | |||
| return this; | |||
| } | |||
| } | |||
| @@ -30,9 +30,9 @@ namespace Discord | |||
| /// <param name="allow">The value of this permission.</param> | |||
| public ApplicationCommandPermission(ulong targetId, ApplicationCommandPermissionTarget targetType, bool allow) | |||
| { | |||
| this.TargetId = targetId; | |||
| this.TargetType = targetType; | |||
| this.Permission = allow; | |||
| TargetId = targetId; | |||
| TargetType = targetType; | |||
| Permission = allow; | |||
| } | |||
| /// <summary> | |||
| @@ -42,9 +42,9 @@ namespace Discord | |||
| /// <param name="allow">The value of this permission.</param> | |||
| public ApplicationCommandPermission(IUser target, bool allow) | |||
| { | |||
| this.TargetId = target.Id; | |||
| this.Permission = allow; | |||
| this.TargetType = ApplicationCommandPermissionTarget.User; | |||
| TargetId = target.Id; | |||
| Permission = allow; | |||
| TargetType = ApplicationCommandPermissionTarget.User; | |||
| } | |||
| /// <summary> | |||
| @@ -54,9 +54,9 @@ namespace Discord | |||
| /// <param name="allow">The value of this permission.</param> | |||
| public ApplicationCommandPermission(IRole target, bool allow) | |||
| { | |||
| this.TargetId = target.Id; | |||
| this.Permission = allow; | |||
| this.TargetType = ApplicationCommandPermissionTarget.Role; | |||
| TargetId = target.Id; | |||
| Permission = allow; | |||
| TargetType = ApplicationCommandPermissionTarget.Role; | |||
| } | |||
| } | |||
| } | |||
| @@ -113,12 +113,18 @@ namespace Discord | |||
| /// <summary> | |||
| /// Allows members to use slash commands in text channels. | |||
| /// </summary> | |||
| [Obsolete("UseSlashCommands has been replaced by UseApplicationCommands", true)] | |||
| UseSlashCommands = 0x00_80_00_00_00, | |||
| /// <summary> | |||
| /// Allows members to use slash commands in text channels. | |||
| /// </summary> | |||
| UseApplicationCommands = 0x00_80_00_00_00, | |||
| /// <summary> | |||
| /// Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.) | |||
| /// </summary> | |||
| RequesToSpeak = 0x01_00_00_00_00, | |||
| RequestToSpeak = 0x01_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for deleting and archiving threads, and viewing all private threads | |||
| @@ -128,12 +134,34 @@ namespace Discord | |||
| /// <summary> | |||
| /// Allows for creating and participating in threads | |||
| /// </summary> | |||
| UsePublicThreads = 0x08_00_00_00_00, | |||
| [Obsolete("UsePublicThreads has been replaced by CreatePublicThreads and SendMessagesInThreads", true)] | |||
| UsePublicThreads = 0x08_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for creating and participating in private threads | |||
| /// </summary> | |||
| [Obsolete("UsePrivateThreads has been replaced by CreatePrivateThreads and SendMessagesInThreads", true)] | |||
| UsePrivateThreads = 0x10_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for creating public threads. | |||
| /// </summary> | |||
| CreatePublicThreads = 0x08_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for creating private threads. | |||
| /// </summary> | |||
| CreatePrivateThreads = 0x10_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows the usage of custom stickers from other servers. | |||
| /// </summary> | |||
| UseExternalStickers = 0x20_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for sending messages in threads. | |||
| /// </summary> | |||
| SendMessagesInThreads = 0x40_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for launching activities (applications with the EMBEDDED flag) in a voice channel. | |||
| /// </summary> | |||
| StartEmbeddedActivities = 0x80_00_00_00_00 | |||
| } | |||
| } | |||
| @@ -7,87 +7,106 @@ namespace Discord | |||
| [DebuggerDisplay("{DebuggerDisplay,nq}")] | |||
| public struct ChannelPermissions | |||
| { | |||
| /// <summary> Gets a blank <see cref="ChannelPermissions"/> that grants no permissions. </summary> | |||
| /// <returns> A <see cref="ChannelPermissions"/> structure that does not contain any set permissions. </returns> | |||
| /// <summary> Gets a blank <see cref="ChannelPermissions"/> that grants no permissions.</summary> | |||
| /// <returns> A <see cref="ChannelPermissions"/> structure that does not contain any set permissions.</returns> | |||
| public static readonly ChannelPermissions None = new ChannelPermissions(); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for text channels. </summary> | |||
| public static readonly ChannelPermissions Text = new ChannelPermissions(0b01100_0000000_1111111110001_010001); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels. </summary> | |||
| public static readonly ChannelPermissions Voice = new ChannelPermissions(0b00100_1111110_0000000011100_010001); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for category channels. </summary> | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for text channels.</summary> | |||
| public static readonly ChannelPermissions Text = new ChannelPermissions(0b0_11111_0101100_0000000_1111111110001_010001); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels.</summary> | |||
| public static readonly ChannelPermissions Voice = new ChannelPermissions(0b1_00000_0000100_1111110_0000000011100_010001); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for stage channels.</summary> | |||
| public static readonly ChannelPermissions Stage = new ChannelPermissions(0b0_00000_1000100_0111010_0000000010000_010001); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for category channels.</summary> | |||
| public static readonly ChannelPermissions Category = new ChannelPermissions(0b01100_1111110_1111111110001_010001); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for direct message channels. </summary> | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for direct message channels.</summary> | |||
| public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110001_000000); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for group channels. </summary> | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for group channels.</summary> | |||
| public static readonly ChannelPermissions Group = new ChannelPermissions(0b00000_1000110_0001101100000_000000); | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for a given channel type. </summary> | |||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for a given channel type.</summary> | |||
| /// <exception cref="ArgumentException">Unknown channel type.</exception> | |||
| public static ChannelPermissions All(IChannel channel) | |||
| { | |||
| switch (channel) | |||
| return channel switch | |||
| { | |||
| case ITextChannel _: return Text; | |||
| case IVoiceChannel _: return Voice; | |||
| case ICategoryChannel _: return Category; | |||
| case IDMChannel _: return DM; | |||
| case IGroupChannel _: return Group; | |||
| default: throw new ArgumentException(message: "Unknown channel type.", paramName: nameof(channel)); | |||
| } | |||
| ITextChannel _ => Text, | |||
| IStageChannel _ => Stage, | |||
| IVoiceChannel _ => Voice, | |||
| ICategoryChannel _ => Category, | |||
| IDMChannel _ => DM, | |||
| IGroupChannel _ => Group, | |||
| _ => throw new ArgumentException(message: "Unknown channel type.", paramName: nameof(channel)), | |||
| }; | |||
| } | |||
| /// <summary> Gets a packed value representing all the permissions in this <see cref="ChannelPermissions"/>. </summary> | |||
| /// <summary> Gets a packed value representing all the permissions in this <see cref="ChannelPermissions"/>.</summary> | |||
| public ulong RawValue { get; } | |||
| /// <summary> If <c>true</c>, a user may create invites. </summary> | |||
| /// <summary> If <c>true</c>, a user may create invites.</summary> | |||
| public bool CreateInstantInvite => Permissions.GetValue(RawValue, ChannelPermission.CreateInstantInvite); | |||
| /// <summary> If <c>true</c>, a user may create, delete and modify this channel. </summary> | |||
| /// <summary> If <c>true</c>, a user may create, delete and modify this channel.</summary> | |||
| public bool ManageChannel => Permissions.GetValue(RawValue, ChannelPermission.ManageChannels); | |||
| /// <summary> If <c>true</c>, a user may add reactions. </summary> | |||
| /// <summary> If <c>true</c>, a user may add reactions.</summary> | |||
| public bool AddReactions => Permissions.GetValue(RawValue, ChannelPermission.AddReactions); | |||
| /// <summary> If <c>true</c>, a user may view channels. </summary> | |||
| /// <summary> If <c>true</c>, a user may view channels.</summary> | |||
| public bool ViewChannel => Permissions.GetValue(RawValue, ChannelPermission.ViewChannel); | |||
| /// <summary> If <c>true</c>, a user may send messages. </summary> | |||
| /// <summary> If <c>true</c>, a user may send messages.</summary> | |||
| public bool SendMessages => Permissions.GetValue(RawValue, ChannelPermission.SendMessages); | |||
| /// <summary> If <c>true</c>, a user may send text-to-speech messages. </summary> | |||
| /// <summary> If <c>true</c>, a user may send text-to-speech messages.</summary> | |||
| public bool SendTTSMessages => Permissions.GetValue(RawValue, ChannelPermission.SendTTSMessages); | |||
| /// <summary> If <c>true</c>, a user may delete messages. </summary> | |||
| /// <summary> If <c>true</c>, a user may delete messages.</summary> | |||
| public bool ManageMessages => Permissions.GetValue(RawValue, ChannelPermission.ManageMessages); | |||
| /// <summary> If <c>true</c>, Discord will auto-embed links sent by this user. </summary> | |||
| /// <summary> If <c>true</c>, Discord will auto-embed links sent by this user.</summary> | |||
| public bool EmbedLinks => Permissions.GetValue(RawValue, ChannelPermission.EmbedLinks); | |||
| /// <summary> If <c>true</c>, a user may send files. </summary> | |||
| /// <summary> If <c>true</c>, a user may send files.</summary> | |||
| public bool AttachFiles => Permissions.GetValue(RawValue, ChannelPermission.AttachFiles); | |||
| /// <summary> If <c>true</c>, a user may read previous messages. </summary> | |||
| /// <summary> If <c>true</c>, a user may read previous messages.</summary> | |||
| public bool ReadMessageHistory => Permissions.GetValue(RawValue, ChannelPermission.ReadMessageHistory); | |||
| /// <summary> If <c>true</c>, a user may mention @everyone. </summary> | |||
| /// <summary> If <c>true</c>, a user may mention @everyone.</summary> | |||
| public bool MentionEveryone => Permissions.GetValue(RawValue, ChannelPermission.MentionEveryone); | |||
| /// <summary> If <c>true</c>, a user may use custom emoji from other guilds. </summary> | |||
| /// <summary> If <c>true</c>, a user may use custom emoji from other guilds.</summary> | |||
| public bool UseExternalEmojis => Permissions.GetValue(RawValue, ChannelPermission.UseExternalEmojis); | |||
| /// <summary> If <c>true</c>, a user may connect to a voice channel. </summary> | |||
| /// <summary> If <c>true</c>, a user may connect to a voice channel.</summary> | |||
| public bool Connect => Permissions.GetValue(RawValue, ChannelPermission.Connect); | |||
| /// <summary> If <c>true</c>, a user may speak in a voice channel. </summary> | |||
| /// <summary> If <c>true</c>, a user may speak in a voice channel.</summary> | |||
| public bool Speak => Permissions.GetValue(RawValue, ChannelPermission.Speak); | |||
| /// <summary> If <c>true</c>, a user may mute users. </summary> | |||
| /// <summary> If <c>true</c>, a user may mute users.</summary> | |||
| public bool MuteMembers => Permissions.GetValue(RawValue, ChannelPermission.MuteMembers); | |||
| /// <summary> If <c>true</c>, a user may deafen users. </summary> | |||
| /// <summary> If <c>true</c>, a user may deafen users.</summary> | |||
| public bool DeafenMembers => Permissions.GetValue(RawValue, ChannelPermission.DeafenMembers); | |||
| /// <summary> If <c>true</c>, a user may move other users between voice channels. </summary> | |||
| /// <summary> If <c>true</c>, a user may move other users between voice channels.</summary> | |||
| public bool MoveMembers => Permissions.GetValue(RawValue, ChannelPermission.MoveMembers); | |||
| /// <summary> If <c>true</c>, a user may use voice-activity-detection rather than push-to-talk. </summary> | |||
| /// <summary> If <c>true</c>, a user may use voice-activity-detection rather than push-to-talk.</summary> | |||
| public bool UseVAD => Permissions.GetValue(RawValue, ChannelPermission.UseVAD); | |||
| /// <summary> If <c>true</c>, a user may use priority speaker in a voice channel. </summary> | |||
| /// <summary> If <c>true</c>, a user may use priority speaker in a voice channel.</summary> | |||
| public bool PrioritySpeaker => Permissions.GetValue(RawValue, ChannelPermission.PrioritySpeaker); | |||
| /// <summary> If <c>true</c>, a user may stream video in a voice channel. </summary> | |||
| /// <summary> If <c>true</c>, a user may stream video in a voice channel.</summary> | |||
| public bool Stream => Permissions.GetValue(RawValue, ChannelPermission.Stream); | |||
| /// <summary> If <c>true</c>, a user may adjust role permissions. This also implictly grants all other permissions. </summary> | |||
| /// <summary> If <c>true</c>, a user may adjust role permissions. This also implictly grants all other permissions.</summary> | |||
| public bool ManageRoles => Permissions.GetValue(RawValue, ChannelPermission.ManageRoles); | |||
| /// <summary> If <c>true</c>, a user may edit the webhooks for this channel. </summary> | |||
| /// <summary> If <c>true</c>, a user may edit the webhooks for this channel.</summary> | |||
| public bool ManageWebhooks => Permissions.GetValue(RawValue, ChannelPermission.ManageWebhooks); | |||
| /// <summary> If <c>true</c>, a user may use application commands in this guild.</summary> | |||
| public bool UseApplicationCommands => Permissions.GetValue(RawValue, ChannelPermission.UseApplicationCommands); | |||
| /// <summary> If <c>true</c>, a user may request to speak in stage channels.</summary> | |||
| public bool RequestToSpeak => Permissions.GetValue(RawValue, ChannelPermission.RequestToSpeak); | |||
| /// <summary> If <c>true</c>, a user may manage threads in this guild.</summary> | |||
| public bool ManageThreads => Permissions.GetValue(RawValue, ChannelPermission.ManageThreads); | |||
| /// <summary> If <c>true</c>, a user may create public threads in this guild.</summary> | |||
| public bool CreatePublicThreads => Permissions.GetValue(RawValue, ChannelPermission.CreatePublicThreads); | |||
| /// <summary> If <c>true</c>, a user may create private threads in this guild.</summary> | |||
| public bool CreatePrivateThreads => Permissions.GetValue(RawValue, ChannelPermission.CreatePrivateThreads); | |||
| /// <summary> If <c>true</c>, a user may use external stickers in this guild.</summary> | |||
| public bool UseExternalStickers => Permissions.GetValue(RawValue, ChannelPermission.UseExternalStickers); | |||
| /// <summary> If <c>true</c>, a user may send messages in threads in this guild.</summary> | |||
| public bool SendMessagesInThreads => Permissions.GetValue(RawValue, ChannelPermission.SendMessagesInThreads); | |||
| /// <summary> If <c>true</c>, a user launch application activites in voice channels in this guild.</summary> | |||
| public bool StartEmbeddedActivities => Permissions.GetValue(RawValue, ChannelPermission.StartEmbeddedActivities); | |||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided packed value. </summary> | |||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided packed value.</summary> | |||
| public ChannelPermissions(ulong rawValue) { RawValue = rawValue; } | |||
| private ChannelPermissions(ulong initialValue, | |||
| @@ -112,7 +131,15 @@ namespace Discord | |||
| bool? prioritySpeaker = null, | |||
| bool? stream = null, | |||
| bool? manageRoles = null, | |||
| bool? manageWebhooks = null) | |||
| bool? manageWebhooks = null, | |||
| bool? useApplicationCommands = null, | |||
| bool? requestToSpeak = null, | |||
| bool? manageThreads = null, | |||
| bool? createPublicThreads = null, | |||
| bool? createPrivateThreads = null, | |||
| bool? useExternalStickers = null, | |||
| bool? sendMessagesInThreads = null, | |||
| bool? startEmbeddedActivities = null) | |||
| { | |||
| ulong value = initialValue; | |||
| @@ -138,11 +165,19 @@ namespace Discord | |||
| Permissions.SetValue(ref value, stream, ChannelPermission.Stream); | |||
| Permissions.SetValue(ref value, manageRoles, ChannelPermission.ManageRoles); | |||
| Permissions.SetValue(ref value, manageWebhooks, ChannelPermission.ManageWebhooks); | |||
| Permissions.SetValue(ref value, useApplicationCommands, ChannelPermission.UseApplicationCommands); | |||
| Permissions.SetValue(ref value, requestToSpeak, ChannelPermission.RequestToSpeak); | |||
| Permissions.SetValue(ref value, manageThreads, ChannelPermission.ManageThreads); | |||
| Permissions.SetValue(ref value, createPublicThreads, ChannelPermission.CreatePublicThreads); | |||
| Permissions.SetValue(ref value, createPrivateThreads, ChannelPermission.CreatePrivateThreads); | |||
| Permissions.SetValue(ref value, useExternalStickers, ChannelPermission.UseExternalStickers); | |||
| Permissions.SetValue(ref value, sendMessagesInThreads, ChannelPermission.SendMessagesInThreads); | |||
| Permissions.SetValue(ref value, startEmbeddedActivities, ChannelPermission.StartEmbeddedActivities); | |||
| RawValue = value; | |||
| } | |||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided permissions. </summary> | |||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided permissions.</summary> | |||
| public ChannelPermissions( | |||
| bool createInstantInvite = false, | |||
| bool manageChannel = false, | |||
| @@ -165,13 +200,23 @@ namespace Discord | |||
| bool prioritySpeaker = false, | |||
| bool stream = false, | |||
| bool manageRoles = false, | |||
| bool manageWebhooks = false) | |||
| bool manageWebhooks = false, | |||
| bool useApplicationCommands = false, | |||
| bool requestToSpeak = false, | |||
| bool manageThreads = false, | |||
| bool createPublicThreads = false, | |||
| bool createPrivateThreads = false, | |||
| bool useExternalStickers = false, | |||
| bool sendMessagesInThreads = false, | |||
| bool startEmbeddedActivities = false) | |||
| : this(0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, | |||
| embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, | |||
| speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, stream, manageRoles, manageWebhooks) | |||
| speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, stream, manageRoles, manageWebhooks, | |||
| useApplicationCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads, | |||
| startEmbeddedActivities) | |||
| { } | |||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions. </summary> | |||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions.</summary> | |||
| public ChannelPermissions Modify( | |||
| bool? createInstantInvite = null, | |||
| bool? manageChannel = null, | |||
| @@ -194,7 +239,15 @@ namespace Discord | |||
| bool? prioritySpeaker = null, | |||
| bool? stream = null, | |||
| bool? manageRoles = null, | |||
| bool? manageWebhooks = null) | |||
| bool? manageWebhooks = null, | |||
| bool? useApplicationCommands = null, | |||
| bool? requestToSpeak = null, | |||
| bool? manageThreads = null, | |||
| bool? createPublicThreads = null, | |||
| bool? createPrivateThreads = null, | |||
| bool? useExternalStickers = null, | |||
| bool? sendMessagesInThreads = null, | |||
| bool? startEmbeddedActivities = null) | |||
| => new ChannelPermissions(RawValue, | |||
| createInstantInvite, | |||
| manageChannel, | |||
| @@ -217,7 +270,15 @@ namespace Discord | |||
| prioritySpeaker, | |||
| stream, | |||
| manageRoles, | |||
| manageWebhooks); | |||
| manageWebhooks, | |||
| useApplicationCommands, | |||
| requestToSpeak, | |||
| manageThreads, | |||
| createPublicThreads, | |||
| createPrivateThreads, | |||
| useExternalStickers, | |||
| sendMessagesInThreads, | |||
| startEmbeddedActivities); | |||
| public bool Has(ChannelPermission permission) => Permissions.GetValue(RawValue, permission); | |||
| @@ -34,10 +34,10 @@ namespace Discord | |||
| internal GuildApplicationCommandPermission(ulong commandId, ulong appId, ulong guildId, ApplicationCommandPermission[] permissions) | |||
| { | |||
| this.CommandId = commandId; | |||
| this.ApplicationId = appId; | |||
| this.GuildId = guildId; | |||
| this.Permissions = permissions; | |||
| CommandId = commandId; | |||
| ApplicationId = appId; | |||
| GuildId = guildId; | |||
| Permissions = permissions; | |||
| } | |||
| } | |||
| } | |||
| @@ -178,8 +178,13 @@ namespace Discord | |||
| /// <summary> | |||
| /// Allows members to use slash commands in text channels. | |||
| /// </summary> | |||
| [Obsolete("UseSlashCommands has been replaced by UseApplicationCommands", true)] | |||
| UseSlashCommands = 0x80_00_00_00, | |||
| /// <summary> | |||
| /// Allows members to use application commands like slash commands and context menus in text channels. | |||
| /// </summary> | |||
| UseApplicationCommands = 0x80_00_00_00, | |||
| /// <summary> | |||
| /// Allows for requesting to speak in stage channels. <i>(This permission is under active development and may be changed or removed.)</i>. | |||
| /// </summary> | |||
| RequestToSpeak = 0x01_00_00_00_00, | |||
| @@ -192,17 +197,35 @@ namespace Discord | |||
| /// </remarks> | |||
| ManageThreads = 0x04_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for creating and participating in threads. | |||
| /// Allows for creating public threads. | |||
| /// </summary> | |||
| CreatePublicThreads = 0x08_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for creating private threads. | |||
| /// </summary> | |||
| CreatePrivateThreads = 0x10_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for creating public threads. | |||
| /// </summary> | |||
| UsePublicThreads = 0x08_00_00_00_00, | |||
| [Obsolete("UsePublicThreads has been replaced by CreatePublicThreads and SendMessagesInThreads", true)] | |||
| UsePublicThreads = 0x08_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for creating and participating in private threads. | |||
| /// Allows for creating private threads. | |||
| /// </summary> | |||
| UsePrivateThreads = 0x10_00_00_00_00, | |||
| [Obsolete("UsePrivateThreads has been replaced by CreatePrivateThreads and SendMessagesInThreads", true)] | |||
| UsePrivateThreads = 0x10_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows the usage of custom stickers from other servers. | |||
| /// </summary> | |||
| UseExternalStickers = 0x20_00_00_00_00 | |||
| UseExternalStickers = 0x20_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for sending messages in threads. | |||
| /// </summary> | |||
| SendMessagesInThreads = 0x40_00_00_00_00, | |||
| /// <summary> | |||
| /// Allows for launching activities (applications with the EMBEDDED flag) in a voice channel. | |||
| /// </summary> | |||
| StartEmbeddedActivities = 0x80_00_00_00_00 | |||
| } | |||
| } | |||
| @@ -10,9 +10,9 @@ namespace Discord | |||
| /// <summary> Gets a blank <see cref="GuildPermissions"/> that grants no permissions. </summary> | |||
| public static readonly GuildPermissions None = new GuildPermissions(); | |||
| /// <summary> Gets a <see cref="GuildPermissions"/> that grants all guild permissions for webhook users. </summary> | |||
| public static readonly GuildPermissions Webhook = new GuildPermissions(0b00000_0000000_0001101100000_000000); | |||
| public static readonly GuildPermissions Webhook = new GuildPermissions(0b0_00000_0000000_0000000_0001101100000_000000); | |||
| /// <summary> Gets a <see cref="GuildPermissions"/> that grants all guild permissions. </summary> | |||
| public static readonly GuildPermissions All = new GuildPermissions(0b11111111_11111_1111111_1111111111111_11111); | |||
| public static readonly GuildPermissions All = new GuildPermissions(0b1_11111_1111111_1111111_1111111111111_111111); | |||
| /// <summary> Gets a packed value representing all the permissions in this <see cref="GuildPermissions"/>. </summary> | |||
| public ulong RawValue { get; } | |||
| @@ -84,17 +84,21 @@ namespace Discord | |||
| /// <summary> If <c>true</c>, a user may edit the emojis and stickers for this guild. </summary> | |||
| public bool ManageEmojisAndStickers => Permissions.GetValue(RawValue, GuildPermission.ManageEmojisAndStickers); | |||
| /// <summary> If <c>true</c>, a user may use slash commands in this guild. </summary> | |||
| public bool UseSlashCommands => Permissions.GetValue(RawValue, GuildPermission.UseSlashCommands); | |||
| public bool UseApplicationCommands => Permissions.GetValue(RawValue, GuildPermission.UseApplicationCommands); | |||
| /// <summary> If <c>true</c>, a user may request to speak in stage channels. </summary> | |||
| public bool RequestToSpeak => Permissions.GetValue(RawValue, GuildPermission.RequestToSpeak); | |||
| /// <summary> If <c>true</c>, a user may manage threads in this guild. </summary> | |||
| public bool ManageThreads => Permissions.GetValue(RawValue, GuildPermission.ManageThreads); | |||
| /// <summary> If <c>true</c>, a user may create public threads in this guild. </summary> | |||
| public bool UsePublicThreads => Permissions.GetValue(RawValue, GuildPermission.UsePublicThreads); | |||
| public bool CreatePublicThreads => Permissions.GetValue(RawValue, GuildPermission.CreatePublicThreads); | |||
| /// <summary> If <c>true</c>, a user may create private threads in this guild. </summary> | |||
| public bool UsePrivateThreads => Permissions.GetValue(RawValue, GuildPermission.UsePrivateThreads); | |||
| public bool CreatePrivateThreads => Permissions.GetValue(RawValue, GuildPermission.CreatePrivateThreads); | |||
| /// <summary> If <c>true</c>, a user may use external stickers in this guild. </summary> | |||
| public bool UseExternalStickers => Permissions.GetValue(RawValue, GuildPermission.UseExternalStickers); | |||
| /// <summary> If <c>true</c>, a user may send messages in threads in this guild. </summary> | |||
| public bool SendMessagesInThreads => Permissions.GetValue(RawValue, GuildPermission.SendMessagesInThreads); | |||
| /// <summary> If <c>true</c>, a user launch application activites in voice channels in this guild. </summary> | |||
| public bool StartEmbeddedActivities => Permissions.GetValue(RawValue, GuildPermission.StartEmbeddedActivities); | |||
| /// <summary> Creates a new <see cref="GuildPermissions"/> with the provided packed value. </summary> | |||
| public GuildPermissions(ulong rawValue) { RawValue = rawValue; } | |||
| @@ -134,12 +138,14 @@ namespace Discord | |||
| bool? manageRoles = null, | |||
| bool? manageWebhooks = null, | |||
| bool? manageEmojisAndStickers = null, | |||
| bool? useSlashCommands = null, | |||
| bool? useApplicationCommands = null, | |||
| bool? requestToSpeak = null, | |||
| bool? manageThreads = null, | |||
| bool? usePublicThreads = null, | |||
| bool? usePrivateThreads = null, | |||
| bool? useExternalStickers = null) | |||
| bool? createPublicThreads = null, | |||
| bool? createPrivateThreads = null, | |||
| bool? useExternalStickers = null, | |||
| bool? sendMessagesInThreads = null, | |||
| bool? startEmbeddedActivities = null) | |||
| { | |||
| ulong value = initialValue; | |||
| @@ -174,12 +180,14 @@ namespace Discord | |||
| Permissions.SetValue(ref value, manageRoles, GuildPermission.ManageRoles); | |||
| Permissions.SetValue(ref value, manageWebhooks, GuildPermission.ManageWebhooks); | |||
| Permissions.SetValue(ref value, manageEmojisAndStickers, GuildPermission.ManageEmojisAndStickers); | |||
| Permissions.SetValue(ref value, useSlashCommands, GuildPermission.UseSlashCommands); | |||
| Permissions.SetValue(ref value, useApplicationCommands, GuildPermission.UseApplicationCommands); | |||
| Permissions.SetValue(ref value, requestToSpeak, GuildPermission.RequestToSpeak); | |||
| Permissions.SetValue(ref value, manageThreads, GuildPermission.ManageThreads); | |||
| Permissions.SetValue(ref value, usePublicThreads, GuildPermission.UsePublicThreads); | |||
| Permissions.SetValue(ref value, usePrivateThreads, GuildPermission.UsePrivateThreads); | |||
| Permissions.SetValue(ref value, createPublicThreads, GuildPermission.CreatePublicThreads); | |||
| Permissions.SetValue(ref value, createPrivateThreads, GuildPermission.CreatePrivateThreads); | |||
| Permissions.SetValue(ref value, useExternalStickers, GuildPermission.UseExternalStickers); | |||
| Permissions.SetValue(ref value, sendMessagesInThreads, GuildPermission.SendMessagesInThreads); | |||
| Permissions.SetValue(ref value, startEmbeddedActivities, GuildPermission.StartEmbeddedActivities); | |||
| RawValue = value; | |||
| } | |||
| @@ -217,12 +225,14 @@ namespace Discord | |||
| bool manageRoles = false, | |||
| bool manageWebhooks = false, | |||
| bool manageEmojisAndStickers = false, | |||
| bool useSlashCommands = false, | |||
| bool useApplicationCommands = false, | |||
| bool requestToSpeak = false, | |||
| bool manageThreads = false, | |||
| bool usePublicThreads = false, | |||
| bool usePrivateThreads = false, | |||
| bool useExternalStickers = false) | |||
| bool createPublicThreads = false, | |||
| bool createPrivateThreads = false, | |||
| bool useExternalStickers = false, | |||
| bool sendMessagesInThreads = false, | |||
| bool startEmbeddedActivities = false) | |||
| : this(0, | |||
| createInstantInvite: createInstantInvite, | |||
| manageRoles: manageRoles, | |||
| @@ -255,12 +265,14 @@ namespace Discord | |||
| manageNicknames: manageNicknames, | |||
| manageWebhooks: manageWebhooks, | |||
| manageEmojisAndStickers: manageEmojisAndStickers, | |||
| useSlashCommands: useSlashCommands, | |||
| useApplicationCommands: useApplicationCommands, | |||
| requestToSpeak: requestToSpeak, | |||
| manageThreads: manageThreads, | |||
| usePublicThreads: usePublicThreads, | |||
| usePrivateThreads: usePrivateThreads, | |||
| useExternalStickers: useExternalStickers) | |||
| createPublicThreads: createPublicThreads, | |||
| createPrivateThreads: createPrivateThreads, | |||
| useExternalStickers: useExternalStickers, | |||
| sendMessagesInThreads: sendMessagesInThreads, | |||
| startEmbeddedActivities: startEmbeddedActivities) | |||
| { } | |||
| /// <summary> Creates a new <see cref="GuildPermissions"/> from this one, changing the provided non-null permissions. </summary> | |||
| @@ -296,17 +308,20 @@ namespace Discord | |||
| bool? manageRoles = null, | |||
| bool? manageWebhooks = null, | |||
| bool? manageEmojisAndStickers = null, | |||
| bool? useSlashCommands = null, | |||
| bool? useApplicationCommands = null, | |||
| bool? requestToSpeak = null, | |||
| bool? manageThreads = null, | |||
| bool? usePublicThreads = null, | |||
| bool? usePrivateThreads = null, | |||
| bool? useExternalStickers = null) | |||
| bool? createPublicThreads = null, | |||
| bool? createPrivateThreads = null, | |||
| bool? useExternalStickers = null, | |||
| bool? sendMessagesInThreads = null, | |||
| bool? startEmbeddedActivities = null) | |||
| => new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions, | |||
| viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles, | |||
| readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers, | |||
| useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojisAndStickers, | |||
| useSlashCommands, requestToSpeak, manageThreads, usePublicThreads, usePrivateThreads, useExternalStickers); | |||
| useApplicationCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads, | |||
| startEmbeddedActivities); | |||
| /// <summary> | |||
| /// Returns a value that indicates if a specific <see cref="GuildPermission"/> is enabled | |||
| @@ -1,3 +1,4 @@ | |||
| using Newtonsoft.Json.Linq; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Diagnostics; | |||
| @@ -82,6 +83,22 @@ namespace Discord | |||
| public PermValue ManageRoles => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageRoles); | |||
| /// <summary> If True, a user may edit the webhooks for this channel. </summary> | |||
| public PermValue ManageWebhooks => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageWebhooks); | |||
| /// <summary> If <c>true</c>, a user may use slash commands in this guild. </summary> | |||
| public PermValue UseApplicationCommands => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseApplicationCommands); | |||
| /// <summary> If <c>true</c>, a user may request to speak in stage channels. </summary> | |||
| public PermValue RequestToSpeak => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.RequestToSpeak); | |||
| /// <summary> If <c>true</c>, a user may manage threads in this guild. </summary> | |||
| public PermValue ManageThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageThreads); | |||
| /// <summary> If <c>true</c>, a user may create public threads in this guild. </summary> | |||
| public PermValue CreatePublicThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.CreatePublicThreads); | |||
| /// <summary> If <c>true</c>, a user may create private threads in this guild. </summary> | |||
| public PermValue CreatePrivateThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.CreatePrivateThreads); | |||
| /// <summary> If <c>true</c>, a user may use external stickers in this guild. </summary> | |||
| public PermValue UseExternalStickers => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseExternalStickers); | |||
| /// <summary> If <c>true</c>, a user may send messages in threads in this guild. </summary> | |||
| public PermValue SendMessagesInThreads => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.SendMessagesInThreads); | |||
| /// <summary> If <c>true</c>, a user launch application activites in voice channels in this guild. </summary> | |||
| public PermValue StartEmbeddedActivities => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.StartEmbeddedActivities); | |||
| /// <summary> Creates a new OverwritePermissions with the provided allow and deny packed values. </summary> | |||
| public OverwritePermissions(ulong allowValue, ulong denyValue) | |||
| @@ -119,7 +136,18 @@ namespace Discord | |||
| PermValue? manageRoles = null, | |||
| PermValue? manageWebhooks = null, | |||
| PermValue? prioritySpeaker = null, | |||
| PermValue? stream = null) | |||
| PermValue? stream = null, | |||
| PermValue? useSlashCommands = null, | |||
| PermValue? useApplicationCommands = null, | |||
| PermValue? requestToSpeak = null, | |||
| PermValue? manageThreads = null, | |||
| PermValue? createPublicThreads = null, | |||
| PermValue? createPrivateThreads = null, | |||
| PermValue? usePublicThreads = null, | |||
| PermValue? usePrivateThreads = null, | |||
| PermValue? useExternalStickers = null, | |||
| PermValue? sendMessagesInThreads = null, | |||
| PermValue? startEmbeddedActivities = null) | |||
| { | |||
| Permissions.SetValue(ref allowValue, ref denyValue, createInstantInvite, ChannelPermission.CreateInstantInvite); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, manageChannel, ChannelPermission.ManageChannels); | |||
| @@ -143,6 +171,14 @@ namespace Discord | |||
| Permissions.SetValue(ref allowValue, ref denyValue, stream, ChannelPermission.Stream); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, manageRoles, ChannelPermission.ManageRoles); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, manageWebhooks, ChannelPermission.ManageWebhooks); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, useApplicationCommands, ChannelPermission.UseApplicationCommands); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, requestToSpeak, ChannelPermission.RequestToSpeak); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, manageThreads, ChannelPermission.ManageThreads); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, createPublicThreads, ChannelPermission.CreatePublicThreads); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, createPrivateThreads, ChannelPermission.CreatePrivateThreads); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, useExternalStickers, ChannelPermission.UseExternalStickers); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, sendMessagesInThreads, ChannelPermission.SendMessagesInThreads); | |||
| Permissions.SetValue(ref allowValue, ref denyValue, startEmbeddedActivities, ChannelPermission.StartEmbeddedActivities); | |||
| AllowValue = allowValue; | |||
| DenyValue = denyValue; | |||
| @@ -173,10 +209,23 @@ namespace Discord | |||
| PermValue manageRoles = PermValue.Inherit, | |||
| PermValue manageWebhooks = PermValue.Inherit, | |||
| PermValue prioritySpeaker = PermValue.Inherit, | |||
| PermValue stream = PermValue.Inherit) | |||
| PermValue stream = PermValue.Inherit, | |||
| PermValue useSlashCommands = PermValue.Inherit, | |||
| PermValue useApplicationCommands = PermValue.Inherit, | |||
| PermValue requestToSpeak = PermValue.Inherit, | |||
| PermValue manageThreads = PermValue.Inherit, | |||
| PermValue createPublicThreads = PermValue.Inherit, | |||
| PermValue createPrivateThreads = PermValue.Inherit, | |||
| PermValue usePublicThreads = PermValue.Inherit, | |||
| PermValue usePrivateThreads = PermValue.Inherit, | |||
| PermValue useExternalStickers = PermValue.Inherit, | |||
| PermValue sendMessagesInThreads = PermValue.Inherit, | |||
| PermValue startEmbeddedActivities = PermValue.Inherit) | |||
| : this(0, 0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, | |||
| embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, | |||
| moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream) { } | |||
| moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream, useSlashCommands, useApplicationCommands, | |||
| requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, usePublicThreads, usePrivateThreads, useExternalStickers, | |||
| sendMessagesInThreads, startEmbeddedActivities) { } | |||
| /// <summary> | |||
| /// Initializes a new <see cref="OverwritePermissions" /> from the current one, changing the provided | |||
| @@ -204,10 +253,23 @@ namespace Discord | |||
| PermValue? manageRoles = null, | |||
| PermValue? manageWebhooks = null, | |||
| PermValue? prioritySpeaker = null, | |||
| PermValue? stream = null) | |||
| PermValue? stream = null, | |||
| PermValue? useSlashCommands = null, | |||
| PermValue? useApplicationCommands = null, | |||
| PermValue? requestToSpeak = null, | |||
| PermValue? manageThreads = null, | |||
| PermValue? createPublicThreads = null, | |||
| PermValue? createPrivateThreads = null, | |||
| PermValue? usePublicThreads = null, | |||
| PermValue? usePrivateThreads = null, | |||
| PermValue? useExternalStickers = null, | |||
| PermValue? sendMessagesInThreads = null, | |||
| PermValue? startEmbeddedActivities = null) | |||
| => new OverwritePermissions(AllowValue, DenyValue, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages, | |||
| embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, | |||
| moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream); | |||
| moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream, useSlashCommands, useApplicationCommands, | |||
| requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, usePublicThreads, usePrivateThreads, useExternalStickers, | |||
| sendMessagesInThreads, startEmbeddedActivities); | |||
| /// <summary> | |||
| /// Creates a <see cref="List{T}"/> of all the <see cref="ChannelPermission"/> values that are allowed. | |||
| @@ -50,14 +50,14 @@ namespace Discord | |||
| internal StickerPack(string name, ulong id, ulong skuid, ulong? coverStickerId, string description, ulong bannerAssetId, IEnumerable<TSticker> stickers) | |||
| { | |||
| this.Name = name; | |||
| this.Id = id; | |||
| this.SkuId = skuid; | |||
| this.CoverStickerId = coverStickerId; | |||
| this.Description = description; | |||
| this.BannerAssetId = bannerAssetId; | |||
| this.Stickers = stickers.ToImmutableArray(); | |||
| Name = name; | |||
| Id = id; | |||
| SkuId = skuid; | |||
| CoverStickerId = coverStickerId; | |||
| Description = description; | |||
| BannerAssetId = bannerAssetId; | |||
| Stickers = stickers.ToImmutableArray(); | |||
| } | |||
| } | |||
| } | |||
| @@ -84,7 +84,7 @@ namespace Discord | |||
| /// <example> | |||
| /// <para>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 <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference)"/>.</para> | |||
| /// <code language="cs"> | |||
| /// <code language="cs"> | |||
| /// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles) | |||
| /// await targetChannel.SendFileAsync("fortnite.png"); | |||
| /// </code> | |||
| @@ -34,7 +34,7 @@ namespace Discord | |||
| /// </code> | |||
| /// </example> | |||
| /// <param name="msg">The message to add reactions to.</param> | |||
| /// <param name="reactions">An array of reactions to add to the message</param> | |||
| /// <param name="reactions">An array of reactions to add to the message.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous operation for adding a reaction to this message. | |||
| @@ -59,7 +59,8 @@ namespace Discord | |||
| /// </code> | |||
| /// </example> | |||
| /// <param name="msg">The message to remove reactions from.</param> | |||
| /// <param name="reactions">An array of reactions to remove from the message</param> | |||
| /// <param name="user">The user who removed the reaction.</param> | |||
| /// <param name="reactions">An array of reactions to remove from the message.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous operation for removing a reaction to this message. | |||
| @@ -75,21 +76,25 @@ namespace Discord | |||
| /// <summary> | |||
| /// Sends an inline reply that references a message. | |||
| /// </summary> | |||
| /// <param name="msg">The message that is being replyed on.</param> | |||
| /// <param name="text">The message to be sent.</param> | |||
| /// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | |||
| /// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| /// <param name="allowedMentions"> | |||
| /// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
| /// If <c>null</c>, all mentioned roles and users will be notified. | |||
| /// </param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <param name="components">The message components to be included with this message. Used for interactions.</param> | |||
| /// <param name="stickers">A collection of stickers to send with the message.</param> | |||
| /// <returns> | |||
| /// A task that represents an asynchronous send operation for delivering the message. The task result | |||
| /// contains the sent message. | |||
| /// </returns> | |||
| public static async Task<IUserMessage> ReplyAsync(this IUserMessage msg, string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, ISticker[] stickers = null) | |||
| public static async Task<IUserMessage> ReplyAsync(this IUserMessage msg, string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null) | |||
| { | |||
| return await msg.Channel.SendMessageAsync(text, isTTS, embed, options, allowedMentions, new MessageReference(messageId: msg.Id), components, stickers).ConfigureAwait(false); | |||
| return await msg.Channel.SendMessageAsync(text, isTTS, embed, options, allowedMentions, new MessageReference(messageId: msg.Id), components, stickers, embeds).ConfigureAwait(false); | |||
| } | |||
| } | |||
| } | |||
| @@ -32,6 +32,8 @@ namespace Discord | |||
| /// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | |||
| /// If <c>null</c>, all mentioned roles and users will be notified. | |||
| /// </param> | |||
| /// <param name="component">The message components to be included with this message. Used for interactions.</param> | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| /// <returns> | |||
| /// A task that represents the asynchronous send operation. The task result contains the sent message. | |||
| /// </returns> | |||
| @@ -41,9 +43,10 @@ namespace Discord | |||
| Embed embed = null, | |||
| RequestOptions options = null, | |||
| AllowedMentions allowedMentions = null, | |||
| MessageComponent component = null) | |||
| MessageComponent component = null, | |||
| Embed[] embeds = null) | |||
| { | |||
| return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options, allowedMentions, component: component).ConfigureAwait(false); | |||
| return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options, allowedMentions, component: component, embeds: embeds).ConfigureAwait(false); | |||
| } | |||
| /// <summary> | |||
| @@ -82,6 +85,8 @@ namespace Discord | |||
| /// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | |||
| /// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <param name="component">The message component to be included with this message. Used for interactions.</param> | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| /// <returns> | |||
| /// A task that represents an asynchronous send operation for delivering the message. The task result | |||
| /// contains the sent message. | |||
| @@ -93,9 +98,10 @@ namespace Discord | |||
| bool isTTS = false, | |||
| Embed embed = null, | |||
| RequestOptions options = null, | |||
| MessageComponent component = null) | |||
| MessageComponent component = null, | |||
| Embed[] embeds = null) | |||
| { | |||
| return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, embed, options, component: component).ConfigureAwait(false); | |||
| return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, embed, options, component: component, embeds: embeds).ConfigureAwait(false); | |||
| } | |||
| /// <summary> | |||
| @@ -139,6 +145,8 @@ namespace Discord | |||
| /// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | |||
| /// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||
| /// <param name="options">The options to be used when sending the request.</param> | |||
| /// <param name="component">The message component to be included with this message. Used for interactions.</param> | |||
| /// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param> | |||
| /// <returns> | |||
| /// A task that represents an asynchronous send operation for delivering the message. The task result | |||
| /// contains the sent message. | |||
| @@ -149,9 +157,10 @@ namespace Discord | |||
| bool isTTS = false, | |||
| Embed embed = null, | |||
| RequestOptions options = null, | |||
| MessageComponent component = null) | |||
| MessageComponent component = null, | |||
| Embed[] embeds = null) | |||
| { | |||
| return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, embed, options, component: component).ConfigureAwait(false); | |||
| return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, embed, options, component: component, embeds: embeds).ConfigureAwait(false); | |||
| } | |||
| /// <summary> | |||
| @@ -48,12 +48,8 @@ namespace Discord.Net | |||
| /// <summary> | |||
| /// Initializes a new instance of the <see cref="ApplicationCommandException" /> class. | |||
| /// </summary> | |||
| /// <param name="request">The request that was sent prior to the exception.</param> | |||
| /// <param name="requestJson"></param> | |||
| /// <param name="httpError"></param> | |||
| /// <param name="discordCode">The Discord status code returned.</param> | |||
| /// <param name="reason">The reason behind the exception.</param> | |||
| /// <param name="errors"></param> | |||
| public ApplicationCommandException(string requestJson, HttpException httpError) | |||
| : base("The application command failed to be created!", httpError) | |||
| { | |||
| @@ -7,7 +7,7 @@ namespace Discord.Utils | |||
| /// <summary> | |||
| /// Not full URL validation right now. Just ensures protocol is present and that it's either http or https | |||
| /// </summary> | |||
| /// <param name="url">url to validate before sending to Discord</param> | |||
| /// <param name="url">url to validate before sending to Discord.</param> | |||
| /// <exception cref="InvalidOperationException">A URL must include a protocol (http or https).</exception> | |||
| /// <returns>true if url is valid by our standard, false if null, throws an error upon invalid </returns> | |||
| public static bool Validate(string url) | |||
| @@ -19,18 +19,15 @@ namespace Discord.API | |||
| internal ActionRowComponent() { } | |||
| internal ActionRowComponent(Discord.ActionRowComponent c) | |||
| { | |||
| this.Type = c.Type; | |||
| this.Components = c.Components?.Select<IMessageComponent, IMessageComponent>(x => | |||
| Type = c.Type; | |||
| Components = c.Components?.Select<IMessageComponent, IMessageComponent>(x => | |||
| { | |||
| switch (x.Type) | |||
| return x.Type switch | |||
| { | |||
| case ComponentType.Button: | |||
| return new ButtonComponent(x as Discord.ButtonComponent); | |||
| case ComponentType.SelectMenu: | |||
| return new SelectMenuComponent(x as Discord.SelectMenuComponent); | |||
| default: return null; | |||
| } | |||
| ComponentType.Button => new ButtonComponent(x as Discord.ButtonComponent), | |||
| ComponentType.SelectMenu => new SelectMenuComponent(x as Discord.SelectMenuComponent), | |||
| _ => null, | |||
| }; | |||
| }).ToArray(); | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -30,32 +30,35 @@ namespace Discord.API | |||
| [JsonProperty("options")] | |||
| public Optional<ApplicationCommandOption[]> Options { get; set; } | |||
| [JsonProperty("autocomplete")] | |||
| public Optional<bool> Autocomplete { get; set; } | |||
| public ApplicationCommandOption() { } | |||
| public ApplicationCommandOption(IApplicationCommandOption cmd) | |||
| { | |||
| this.Choices = cmd.Choices.Select(x => new ApplicationCommandOptionChoice() | |||
| Choices = cmd.Choices.Select(x => new ApplicationCommandOptionChoice() | |||
| { | |||
| Name = x.Name, | |||
| Value = x.Value | |||
| }).ToArray(); | |||
| this.Options = cmd.Options.Select(x => new ApplicationCommandOption(x)).ToArray(); | |||
| Options = cmd.Options.Select(x => new ApplicationCommandOption(x)).ToArray(); | |||
| this.Required = cmd.Required.HasValue | |||
| Required = cmd.Required.HasValue | |||
| ? cmd.Required.Value | |||
| : Optional<bool>.Unspecified; | |||
| this.Default = cmd.Default.HasValue | |||
| Default = cmd.Default.HasValue | |||
| ? cmd.Default.Value | |||
| : Optional<bool>.Unspecified; | |||
| this.Name = cmd.Name; | |||
| this.Type = cmd.Type; | |||
| this.Description = cmd.Description; | |||
| Name = cmd.Name; | |||
| Type = cmd.Type; | |||
| Description = cmd.Description; | |||
| } | |||
| public ApplicationCommandOption(Discord.ApplicationCommandOptionProperties option) | |||
| { | |||
| this.Choices = option.Choices != null | |||
| Choices = option.Choices != null | |||
| ? option.Choices.Select(x => new ApplicationCommandOptionChoice() | |||
| { | |||
| Name = x.Name, | |||
| @@ -63,21 +66,22 @@ namespace Discord.API | |||
| }).ToArray() | |||
| : Optional<ApplicationCommandOptionChoice[]>.Unspecified; | |||
| this.Options = option.Options != null | |||
| Options = option.Options != null | |||
| ? option.Options.Select(x => new ApplicationCommandOption(x)).ToArray() | |||
| : Optional<ApplicationCommandOption[]>.Unspecified; | |||
| this.Required = option.Required.HasValue | |||
| Required = option.Required.HasValue | |||
| ? option.Required.Value | |||
| : Optional<bool>.Unspecified; | |||
| this.Default = option.Default.HasValue | |||
| Default = option.Default.HasValue | |||
| ? option.Default.Value | |||
| : Optional<bool>.Unspecified; | |||
| this.Name = option.Name; | |||
| this.Type = option.Type; | |||
| this.Description = option.Description; | |||
| Name = option.Name; | |||
| Type = option.Type; | |||
| Description = option.Description; | |||
| Autocomplete = option.Autocomplete; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -0,0 +1,27 @@ | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace Discord.API | |||
| { | |||
| internal class AutocompleteInteractionData : IDiscordInteractionData | |||
| { | |||
| [JsonProperty("id")] | |||
| public ulong Id { get; set; } | |||
| [JsonProperty("name")] | |||
| public string Name { get; set; } | |||
| [JsonProperty("type")] | |||
| public ApplicationCommandType Type { get; set; } | |||
| [JsonProperty("version")] | |||
| public ulong Version { get; set; } | |||
| [JsonProperty("options")] | |||
| public AutocompleteInteractionDataOption[] Options { get; set; } | |||
| } | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace Discord.API | |||
| { | |||
| internal class AutocompleteInteractionDataOption | |||
| { | |||
| [JsonProperty("type")] | |||
| public ApplicationCommandOptionType Type { get; set; } | |||
| [JsonProperty("name")] | |||
| public string Name { get; set; } | |||
| [JsonProperty("value")] | |||
| public object Value { get; set; } | |||
| [JsonProperty("focused")] | |||
| public bool Focused { get; set; } | |||
| } | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -34,18 +34,18 @@ namespace Discord.API | |||
| public ButtonComponent(Discord.ButtonComponent c) | |||
| { | |||
| this.Type = c.Type; | |||
| this.Style = c.Style; | |||
| this.Label = c.Label; | |||
| this.CustomId = c.CustomId; | |||
| this.Url = c.Url; | |||
| this.Disabled = c.Disabled; | |||
| Type = c.Type; | |||
| Style = c.Style; | |||
| Label = c.Label; | |||
| CustomId = c.CustomId; | |||
| Url = c.Url; | |||
| Disabled = c.Disabled; | |||
| if (c.Emote != null) | |||
| { | |||
| if (c.Emote is Emote e) | |||
| { | |||
| this.Emote = new Emoji() | |||
| Emote = new Emoji() | |||
| { | |||
| Name = e.Name, | |||
| Animated = e.Animated, | |||
| @@ -54,7 +54,7 @@ namespace Discord.API | |||
| } | |||
| else | |||
| { | |||
| this.Emote = new Emoji() | |||
| Emote = new Emoji() | |||
| { | |||
| Name = c.Emote.Name | |||
| }; | |||
| @@ -63,6 +63,6 @@ namespace Discord.API | |||
| } | |||
| [JsonIgnore] | |||
| string IMessageComponent.CustomId => this.CustomId.GetValueOrDefault(); | |||
| string IMessageComponent.CustomId => CustomId.GetValueOrDefault(); | |||
| } | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System.Collections.Generic; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using System; | |||
| using Newtonsoft.Json; | |||
| using Discord.Net.Converters; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using Newtonsoft.Json.Serialization; | |||
| using System.Runtime.Serialization; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -21,5 +21,8 @@ namespace Discord.API | |||
| [JsonProperty("components")] | |||
| public Optional<API.ActionRowComponent[]> Components { get; set; } | |||
| [JsonProperty("choices")] | |||
| public Optional<API.ApplicationCommandOptionChoice[]> Choices { get; set; } | |||
| } | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| namespace Discord.API | |||
| { | |||
| internal enum RelationshipType | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -34,13 +34,13 @@ namespace Discord.API | |||
| public SelectMenuComponent(Discord.SelectMenuComponent component) | |||
| { | |||
| this.Type = component.Type; | |||
| this.CustomId = component.CustomId; | |||
| this.Options = component.Options.Select(x => new SelectMenuOption(x)).ToArray(); | |||
| this.Placeholder = component.Placeholder; | |||
| this.MinValues = component.MinValues; | |||
| this.MaxValues = component.MaxValues; | |||
| this.Disabled = component.Disabled; | |||
| Type = component.Type; | |||
| CustomId = component.CustomId; | |||
| Options = component.Options.Select(x => new SelectMenuOption(x)).ToArray(); | |||
| Placeholder = component.Placeholder; | |||
| MinValues = component.MinValues; | |||
| MaxValues = component.MaxValues; | |||
| Disabled = component.Disabled; | |||
| } | |||
| } | |||
| } | |||
| @@ -28,15 +28,15 @@ namespace Discord.API | |||
| public SelectMenuOption(Discord.SelectMenuOption option) | |||
| { | |||
| this.Label = option.Label; | |||
| this.Value = option.Value; | |||
| this.Description = option.Description; | |||
| Label = option.Label; | |||
| Value = option.Value; | |||
| Description = option.Description; | |||
| if (option.Emote != null) | |||
| { | |||
| if (option.Emote is Emote e) | |||
| { | |||
| this.Emoji = new Emoji() | |||
| Emoji = new Emoji() | |||
| { | |||
| Name = e.Name, | |||
| Animated = e.Animated, | |||
| @@ -45,14 +45,14 @@ namespace Discord.API | |||
| } | |||
| else | |||
| { | |||
| this.Emoji = new Emoji() | |||
| Emoji = new Emoji() | |||
| { | |||
| Name = option.Emote.Name | |||
| }; | |||
| } | |||
| } | |||
| this.Default = option.Default.HasValue ? option.Default.Value : Optional<bool>.Unspecified; | |||
| Default = option.Default.HasValue ? option.Default.Value : Optional<bool>.Unspecified; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using System; | |||
| namespace Discord.API | |||
| @@ -12,7 +12,7 @@ namespace Discord.Net.Rest | |||
| { | |||
| Stream = stream; | |||
| Filename = filename; | |||
| this.ContentType = contentType; | |||
| ContentType = contentType; | |||
| } | |||
| } | |||
| } | |||
| @@ -28,10 +28,10 @@ namespace Discord.API.Rest | |||
| public CreateApplicationCommandParams() { } | |||
| public CreateApplicationCommandParams(string name, string description, ApplicationCommandType type, ApplicationCommandOption[] options = null) | |||
| { | |||
| this.Name = name; | |||
| this.Description = description; | |||
| this.Options = Optional.Create<ApplicationCommandOption[]>(options); | |||
| this.Type = type; | |||
| Name = name; | |||
| Description = description; | |||
| Options = Optional.Create<ApplicationCommandOption[]>(options); | |||
| Type = type; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API.Rest | |||
| @@ -1,4 +1,3 @@ | |||
| #pragma warning disable CS1591 | |||
| using Newtonsoft.Json; | |||
| namespace Discord.API.Rest | |||