Ejemplo n.º 1
0
        public static ModifyApplicationCommandJsonRestRequestContent ToContent(this Action <ModifyApplicationCommandActionProperties> action, IJsonSerializer serializer)
        {
            Guard.IsNotNull(action);

            var properties = new ModifyApplicationCommandActionProperties();

            action(properties);

            var content = new ModifyApplicationCommandJsonRestRequestContent
            {
                Name              = properties.Name,
                Description       = properties.Description,
                DefaultPermission = properties.IsEnabledByDefault,
                Options           = Optional.Convert(properties.Options, options => options?.Select(option => option?.ToModel(serializer)).ToArray())
            };

            return(content);
        }
        public static Task <ApplicationCommandJsonModel> ModifyGuildApplicationCommandAsync(this IRestApiClient client, Snowflake applicationId, Snowflake guildId, Snowflake commandId, ModifyApplicationCommandJsonRestRequestContent content, IRestRequestOptions options = null)
        {
            var route = Format(Route.Interactions.ModifyGuildCommand, applicationId, guildId, commandId);

            return(client.ExecuteAsync <ApplicationCommandJsonModel>(route, content, options));
        }
        public static Task <ApplicationCommandJsonModel> ModifyGlobalApplicationCommandAsync(this IRestApiClient client,
                                                                                             Snowflake applicationId, Snowflake commandId, ModifyApplicationCommandJsonRestRequestContent content,
                                                                                             IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var route = Format(Route.Interactions.ModifyGlobalCommand, applicationId, commandId);

            return(client.ExecuteAsync <ApplicationCommandJsonModel>(route, content, options, cancellationToken));
        }