コード例 #1
0
        /// <summary>
        ///     Modifies this interaction followup message.
        /// </summary>
        /// <remarks>
        ///     This method modifies this message with the specified properties. To see an example of this
        ///     method and what properties are available, please refer to <see cref="MessageProperties"/>.
        /// </remarks>
        /// <example>
        ///     <para>The following example replaces the content of the message with <c>Hello World!</c>.</para>
        ///     <code language="cs">
        ///     await msg.ModifyAsync(x =&gt; x.Content = "Hello World!");
        ///     </code>
        /// </example>
        /// <param name="func">A delegate containing the properties to modify the message with.</param>
        /// <param name="options">The options to be used when sending the request.</param>
        /// <returns>
        ///     A task that represents the asynchronous modification operation.
        /// </returns>
        /// <exception cref="InvalidOperationException">The token used to modify/delete this message expired.</exception>
        /// /// <exception cref="Discord.Net.HttpException">Something went wrong during the request.</exception>
        public new async Task ModifyAsync(Action <MessageProperties> func, RequestOptions options = null)
        {
            try
            {
                var model = await InteractionHelper.ModifyFollowupMessageAsync(Discord, this, func, options).ConfigureAwait(false);

                Update(model);
            }
            catch (Net.HttpException x)
            {
                if (x.HttpCode == System.Net.HttpStatusCode.NotFound)
                {
                    throw new InvalidOperationException("The token of this message has expired!", x);
                }

                throw;
            }
        }
コード例 #2
0
 /// <summary>
 ///     Deletes this object and all of it's children.
 /// </summary>
 /// <returns>A task that represents the asynchronous delete operation.</returns>
 public Task DeleteAsync()
 => InteractionHelper.DeleteFollowupMessageAsync(Discord, this);
コード例 #3
0
 public override async Task DeleteAsync(RequestOptions options = null)
 => await InteractionHelper.DeleteGuildCommand(Discord, this).ConfigureAwait(false);
コード例 #4
0
 /// <summary>
 ///     Modifies this <see cref="RestApplicationCommand"/>.
 /// </summary>
 /// <param name="func">The delegate containing the properties to modify the command with.</param>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     The modified command
 /// </returns>
 public async Task <RestGuildCommand> ModifyAsync(Action <ApplicationCommandProperties> func, RequestOptions options = null)
 => await InteractionHelper.ModifyGuildCommand(Discord, this, func, options).ConfigureAwait(false);
コード例 #5
0
 public Task <RestGlobalCommand> CreateGlobalCommand(Action <SlashCommandCreationProperties> func, RequestOptions options = null)
 => InteractionHelper.CreateGlobalCommand(this, func, options);
コード例 #6
0
 public Task <RestGuildCommand> CreateGuildCommand(Action <SlashCommandCreationProperties> func, ulong guildId, RequestOptions options = null)
 => InteractionHelper.CreateGuildCommand(this, guildId, func, options);
コード例 #7
0
 /// <summary>
 ///     Modifies the current command permissions for this guild command.
 /// </summary>
 /// <param name="permissions">The permissions to overwrite.</param>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///      A task that represents the asynchronous modification operation. The task result contains a
 ///     <see cref="GuildApplicationCommandPermission"/> object containing the modified permissions.
 /// </returns>
 public Task <GuildApplicationCommandPermission> ModifyCommandPermissions(ApplicationCommandPermission[] permissions, RequestOptions options = null)
 => InteractionHelper.ModifyGuildCommandPermissionsAsync(Discord, GuildId, Id, permissions, options);
コード例 #8
0
 public Task <RestGlobalCommand> CreateGlobalCommand(SlashCommandCreationProperties properties, RequestOptions options = null)
 => InteractionHelper.CreateGlobalCommand(this, properties, options);
コード例 #9
0
        /// <summary>
        ///     Modifies this <see cref="RestApplicationCommand"/>.
        /// </summary>
        /// <param name="func">The delegate containing the properties to modify the command with.</param>
        /// <param name="options">The options to be used when sending the request.</param>
        /// <returns>
        ///     The modified command
        /// </returns>
        public override async Task ModifyAsync <TArg>(Action <TArg> func, RequestOptions options = null)
        {
            var model = await InteractionHelper.ModifyGuildCommandAsync(Discord, this, GuildId, func, options).ConfigureAwait(false);

            Update(model);
        }
コード例 #10
0
 /// <summary>
 ///     Gets this commands permissions inside of the current guild.
 /// </summary>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     A task that represents the asynchronous get operation. The task result contains a
 ///     <see cref="GuildApplicationCommandPermission"/> object defining the permissions of the current slash command.
 /// </returns>
 public Task <GuildApplicationCommandPermission> GetCommandPermission(RequestOptions options = null)
 => InteractionHelper.GetGuildCommandPermissionAsync(Discord, GuildId, Id, options);
コード例 #11
0
        /// <summary>
        ///     Modifies this <see cref="RestApplicationCommand"/>.
        /// </summary>
        /// <param name="func">The delegate containing the properties to modify the command with.</param>
        /// <param name="options">The options to be used when sending the request.</param>
        /// <returns>
        ///     The modified command.
        /// </returns>
        public override async Task ModifyAsync <TArg>(Action <TArg> func, RequestOptions options = null)
        {
            var cmd = await InteractionHelper.ModifyGlobalCommandAsync(Discord, this, func, options).ConfigureAwait(false);

            Update(cmd);
        }
コード例 #12
0
 /// <summary>
 ///     Deletes this object and all of it's children.
 /// </summary>
 /// <returns>A task that represents the asynchronous delete operation.</returns>
 public Task DeleteAsync()
 => InteractionHelper.DeleteInteractionResponseAsync(Discord, this);
コード例 #13
0
 public Task <RestGuildCommand[]> CreateGuildCommands(List <SlashCommandCreationProperties> properties, ulong guildId, RequestOptions options = null)
 => InteractionHelper.CreateGuildCommands(this, guildId, properties, options);
コード例 #14
0
 public static Task DeleteGuildCommandAsync(BaseDiscordClient client, ulong guildId, IApplicationCommand command, RequestOptions options = null)
 {
     return(InteractionHelper.DeleteGuildCommandAsync(client, guildId, command, options));
 }
コード例 #15
0
        public static async Task <RestGuildCommand> ModifyGuildApplicationCommandAsync(BaseDiscordClient client, IApplicationCommand command, ulong guildId, ApplicationCommandProperties args, RequestOptions options = null)
        {
            var model = await InteractionHelper.ModifyGuildCommandAsync(client, command, guildId, args, options);

            return(RestGuildCommand.Create(client, model, guildId));
        }