/// Creates a global [`ApplicationCommand`],
/// overriding an existing one with the same name if it exists.
///
/// When a created [`ApplicationCommand`] is used, the [`InteractionCreate`] event will be emitted.
///
/// **Note**: Global commands may take up to an hour to be updated in the user slash commands
/// list. If an outdated command data is sent by a user, discord will consider it as an error
/// and then will instantly update that command.
///
/// As such, it is recommended that guild application commands be used for testing purposes.
///
/// # Examples
///
/// Create a simple ping command:
///
/// ```rust,no_run
/// # use serenity::http::Http;
/// # use std::sync::Arc;
/// #
/// # async fn run() {
/// # let http = Arc::new(Http::default());
/// use serenity::model::{interactions::application_command::ApplicationCommand, id::ApplicationId};
///
/// let _ = ApplicationCommand::create_global_application_command(&http, |command| {
///    command.name("ping")
///     .description("A simple ping command")
/// })
/// .await;
/// # }
/// ```
///
/// Create a command that echoes what is inserted:
///
/// ```rust,no_run
/// # use serenity::http::Http;
/// # use std::sync::Arc;
/// #
/// # async fn run() {
/// # let http = Arc::new(Http::default());
/// use serenity::model::{
///     interactions::application_command::{ApplicationCommand, ApplicationCommandOptionType},
///     id::ApplicationId
/// };
///
/// let _ = ApplicationCommand::create_global_application_command(&http, |command| {
///    command.name("echo")
///     .description("Makes the bot send a message")
///     .create_option(|option| {
///         option.name("message")
///          .description("The message to send")
///          .kind(ApplicationCommandOptionType::String)
///          .required(true)
///     })
/// })
/// .await;
/// # }
/// ```
///
/// # Errors
///
/// May return an [`Error::Http`] if the [`ApplicationCommand`] is illformed,
/// such as if more than 10 [`choices`] are set. See the [API Docs] for further details.
///
/// Can also return an [`Error::Json`] if there is an error in deserializing
/// the response.
///
/// [`ApplicationCommand`]: crate::model::interactions::application_command::ApplicationCommand
/// [`InteractionCreate`]: crate::client::EventHandler::interaction_create
/// [API Docs]: https://discord.com/developers/docs/interactions/slash-commands
/// [`Error::Http`]: crate::error::Error::Http
/// [`Error::Json`]: crate::error::Error::Json
/// [`choices`]: crate::model::interactions::application_command::ApplicationCommandOption::choices
Creates a global [`ApplicationCommand`],
overriding an existing one with the same name if it exists.

When a created [`ApplicationCommand`] is used, the [`InteractionCreate`] event will be emitted.

Note**: Global commands may take up to an hour to be updated in the user slash commands
list. If an outdated command data is sent by a user, discord will consider it as an error
and then will instantly update that command.

As such, it is recommended that guild application commands be used for testing purposes.
Creates a global [ ` ApplicationCommand ` ] overriding an existing one with the same name if it exists . When a created [ ` ApplicationCommand ` ] is used the [ ` InteractionCreate ` ] event will be emitted . Note ** : Global commands may take up to an hour to be updated in the user slash commands list . If an outdated command data is sent by a user discord will consider it as an error and then will instantly update that command . As such it is recommended that guild application commands be used for testing purposes .
pub async fn create_global_application_command<F>(
        http: impl AsRef<Http>,
        f: F,
    ) -> Result<ApplicationCommand>
    where
        F: FnOnce(&mut CreateApplicationCommand) -> &mut CreateApplicationCommand,
    {
        let map = ApplicationCommand::build_application_command(f);
        http.as_ref().create_global_application_command(&Value::Object(map)).await
    }
pub async fn create_global_application_command < F > ( http : impl AsRef < Http > , f : F , ) -> Result < ApplicationCommand > where F : FnOnce ( & mut CreateApplicationCommand ) -> & mut CreateApplicationCommand , { let map = ApplicationCommand :: build_application_command ( f ) ; http . as_ref ( ) . create_global_application_command ( & Value :: Object ( map ) ) . await }
Creates a global [`ApplicationCommand`],
overriding an existing one with the same name if it exists.
Creates a global [ ` ApplicationCommand ` ] overriding an existing one with the same name if it exists .
http
impl AsRef<Http>
f
F
examples
Create a simple ping command.


Create a simple ping command .
use serenity::http::http;
None
use std::sync::arc;
None
async fn run() {
None
let http = arc::new(http::default());
use serenity::model::{interactions::application_command::ApplicationCommand, id::ApplicationId}.

let _ = ApplicationCommand::create_global_application_command(&http, |command| {
command.name("ping")
.description("A simple ping command")
})
.await.
use serenity :: model :: { interactions :: application_command :: ApplicationCommand id :: ApplicationId } . let _ = ApplicationCommand :: create_global_application_command ( &http |command| { command . name ( " ping " ) . description ( " A simple ping command " ) } ) . await .
}


Create a command that echoes what is inserted.


Create a command that echoes what is inserted .
use serenity::http::http;
None
use std::sync::arc;
None
async fn run() {
None
let http = arc::new(http::default());
use serenity::model::{
interactions::application_command::{ApplicationCommand, ApplicationCommandOptionType},
id::ApplicationId
}.

let _ = ApplicationCommand::create_global_application_command(&http, |command| {
command.name("echo")
.description("Makes the bot send a message")
.create_option(|option| {
option.name("message")
.description("The message to send")
.kind(ApplicationCommandOptionType::String)
.required(true)
})
})
.await.
use serenity :: model :: { interactions :: application_command :: { ApplicationCommand ApplicationCommandOptionType } id :: ApplicationId } . let _ = ApplicationCommand :: create_global_application_command ( &http |command| { command . name ( " echo " ) . description ( " Makes the bot send a message " ) . create_option ( |option| { option . name ( " message " ) . description ( " The message to send " ) . kind ( ApplicationCommandOptionType :: String ) . required ( true ) } ) } ) . await .
}
None
errors
May return an [`Error::Http`] if the [`ApplicationCommand`] is illformed,
such as if more than 10 [`choices`] are set. See the [API Docs] for further details.

Can also return an [`Error::Json`] if there is an error in deserializing
the response.


May return an [ ` Error :: Http ` ] if the [ ` ApplicationCommand ` ] is illformed such as if more than 10 [ ` choices ` ] are set . See the [ API Docs ] for further details . Can also return an [ ` Error :: Json ` ] if there is an error in deserializing the response .