glyde/api/application_command

Registering commands, globally and for one guild.

The application id is not a major parameter, so the global routes share one bucket per method and path across every application. The guild routes take the guild major.

Discord meters command creates at 200 a day per guild. A create for a name that already exists is an update and does not count, so a startup sync that only overwrites spends none of that budget.

The mutating routes take a payload/command value, not a body, so the two fields only a global command may carry and the top-level array a bulk overwrite wants cannot arrive at the wrong route.

Values

pub fn create_global_command(
  application: id.Id(id.Application),
  create: command.GlobalCommand,
) -> rest.Call(application_command.ApplicationCommand)

POST /applications/{application.id}/commands. Safe to run on every boot: Discord answers 200 and updates in place when the name already exists.

pub fn create_guild_command(
  application: id.Id(id.Application),
  guild: id.Id(id.Guild),
  create: command.CreateApplicationCommand,
) -> rest.Call(application_command.ApplicationCommand)

POST /applications/{application.id}/guilds/{guild.id}/commands. Appears immediately, where a global command can take an hour to propagate.

pub fn delete_global_command(
  application: id.Id(id.Application),
  command_id: id.Id(id.Command),
) -> rest.Call(Nil)
pub fn delete_guild_command(
  application: id.Id(id.Application),
  guild: id.Id(id.Guild),
  command_id: id.Id(id.Command),
) -> rest.Call(Nil)
pub fn edit_global_command(
  application: id.Id(id.Application),
  command_id: id.Id(id.Command),
  edit: command.EditGlobalCommand,
) -> rest.Call(application_command.ApplicationCommand)

PATCH /applications/{application.id}/commands/{command.id}.

pub fn edit_guild_command(
  application: id.Id(id.Application),
  guild: id.Id(id.Guild),
  command_id: id.Id(id.Command),
  edit: command.EditApplicationCommand,
) -> rest.Call(application_command.ApplicationCommand)

PATCH /applications/{application.id}/guilds/{guild.id}/commands/{id}.

pub fn get_global_commands(
  application: id.Id(id.Application),
  with_localizations with_localizations: Bool,
) -> rest.Call(List(application_command.ApplicationCommand))

GET /applications/{application.id}/commands. name and description arrive either way. with_localizations swaps the single name_localized and description_localized for the full name_localizations and description_localizations maps.

pub fn get_guild_commands(
  application: id.Id(id.Application),
  guild: id.Id(id.Guild),
  with_localizations with_localizations: Bool,
) -> rest.Call(List(application_command.ApplicationCommand))
pub fn set_global_commands(
  application: id.Id(id.Application),
  commands: List(command.GlobalCommand),
) -> rest.Call(List(application_command.ApplicationCommand))

PUT /applications/{application.id}/commands, replacing the whole set. Every command type at once: a list holding only slash commands silently deletes the application’s user and message commands.

pub fn set_guild_commands(
  application: id.Id(id.Application),
  guild: id.Id(id.Guild),
  commands: List(command.CreateApplicationCommand),
) -> rest.Call(List(application_command.ApplicationCommand))

PUT /applications/{application.id}/guilds/{guild.id}/commands, which replaces every command type this application has in that guild.

Search Document