public static CreateApplicationCommandJsonRestRequestContent ToContent(this LocalApplicationCommand command, IJsonSerializer serializer)
        {
            Guard.IsNotNull(command);

            var content = new CreateApplicationCommandJsonRestRequestContent
            {
                Name = command.Name.Value,
                DefaultPermission = command.IsEnabledByDefault
            };

            if (command is LocalSlashCommand slashCommand)
            {
                content.Type        = ApplicationCommandType.Slash;
                content.Description = slashCommand.Description;
                content.Options     = Optional.Convert(slashCommand.Options, options => options?.Select(option => option?.ToModel(serializer)).ToArray());
            }
            else if (command is LocalUserContextMenuCommand)
            {
                content.Type = ApplicationCommandType.User;
            }
            else if (command is LocalMessageContextMenuCommand)
            {
                content.Type = ApplicationCommandType.Message;
            }

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

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

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