public static async Task <IApplicationCommand> FetchGuildApplicationCommandAsync(this IRestClient client, Snowflake applicationId, Snowflake guildId, Snowflake commandId, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { var model = await client.ApiClient.FetchGuildApplicationCommandAsync(applicationId, guildId, commandId, options, cancellationToken).ConfigureAwait(false); return(TransientApplicationCommand.Create(client, model)); }
public static async Task <IReadOnlyList <IApplicationCommand> > FetchGlobalApplicationCommandsAsync(this IRestClient client, Snowflake applicationId, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { var models = await client.ApiClient.FetchGlobalApplicationCommandsAsync(applicationId, options, cancellationToken).ConfigureAwait(false); return(models.ToReadOnlyList(client, (model, client) => TransientApplicationCommand.Create(client, model))); }
public static async Task <IApplicationCommand> ModifyGuildApplicationCommandAsync(this IRestClient client, Snowflake applicationId, Snowflake guildId, Snowflake commandId, Action <ModifyApplicationCommandActionProperties> action, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { var content = action.ToContent(client.ApiClient.Serializer); var model = await client.ApiClient.ModifyGuildApplicationCommandAsync(applicationId, guildId, commandId, content, options, cancellationToken).ConfigureAwait(false); return(TransientApplicationCommand.Create(client, model)); }
public static async Task <IApplicationCommand> CreateGuildApplicationCommandAsync(this IRestClient client, Snowflake applicationId, Snowflake guildId, LocalApplicationCommand command, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { var content = command.ToContent(client.ApiClient.Serializer); var model = await client.ApiClient.CreateGuildApplicationCommandAsync(applicationId, guildId, content, options, cancellationToken).ConfigureAwait(false); return(TransientApplicationCommand.Create(client, model)); }
public static async Task <IReadOnlyList <IApplicationCommand> > SetGlobalApplicationCommandsAsync(this IRestClient client, Snowflake applicationId, IEnumerable <LocalApplicationCommand> commands, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { var contents = commands.Select(command => command.ToContent(client.ApiClient.Serializer)).ToArray(); var models = await client.ApiClient.SetGlobalApplicationCommandsAsync(applicationId, contents, options, cancellationToken); return(models.ToReadOnlyList(client, (model, client) => TransientApplicationCommand.Create(client, model))); }