/// <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 => 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; } }
/// <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);
public override async Task DeleteAsync(RequestOptions options = null) => await InteractionHelper.DeleteGuildCommand(Discord, this).ConfigureAwait(false);
/// <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);
public Task <RestGlobalCommand> CreateGlobalCommand(Action <SlashCommandCreationProperties> func, RequestOptions options = null) => InteractionHelper.CreateGlobalCommand(this, func, options);
public Task <RestGuildCommand> CreateGuildCommand(Action <SlashCommandCreationProperties> func, ulong guildId, RequestOptions options = null) => InteractionHelper.CreateGuildCommand(this, guildId, func, options);
/// <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);
public Task <RestGlobalCommand> CreateGlobalCommand(SlashCommandCreationProperties properties, RequestOptions options = null) => InteractionHelper.CreateGlobalCommand(this, properties, options);
/// <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); }
/// <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);
/// <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); }
/// <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);
public Task <RestGuildCommand[]> CreateGuildCommands(List <SlashCommandCreationProperties> properties, ulong guildId, RequestOptions options = null) => InteractionHelper.CreateGuildCommands(this, guildId, properties, options);
public static Task DeleteGuildCommandAsync(BaseDiscordClient client, ulong guildId, IApplicationCommand command, RequestOptions options = null) { return(InteractionHelper.DeleteGuildCommandAsync(client, guildId, command, options)); }
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)); }