API: Interactions & Commands
All on the Lingo module. Return {:ok, data} or {:error, reason} unless noted.
Interaction Responses
Most of the time you'll use the context helpers (reply!, defer!, update!, show_modal!). These are the lower-level functions underneath them.
create_interaction_response
Lingo.create_interaction_response(interaction_id, token, type, data \\ nil)type is one of: :pong, :channel_message, :deferred_channel_message, :deferred_update_message, :update_message, :autocomplete, :modal.
get_original_response
Lingo.get_original_response(token)edit_original_response
Lingo.edit_original_response(token, params)Supports file attachments.
delete_original_response
Lingo.delete_original_response(token)create_followup
Lingo.create_followup(token, params)Supports file attachments.
get_followup / edit_followup / delete_followup
Lingo.get_followup(token, message_id)
Lingo.edit_followup(token, message_id, params)
Lingo.delete_followup(token, message_id)edit_followup supports file attachments.
Command Registration
register_commands
Lingo.register_commands(MyBot.Bot)Push all commands from a bot module as global commands. Uses bulk overwrite, so it replaces everything each time. Global commands can take up to an hour to show up.
register_commands_to_guild
Lingo.register_commands_to_guild(MyBot.Bot, "123456789")Push all commands to a specific guild. Updates instantly, so it's good for development.
Low-Level Command Management
These hit the API directly, bypassing your bot module's command definitions.
Global Commands
Lingo.list_global_commands()
Lingo.get_global_command(command_id)
Lingo.create_global_command(params)
Lingo.edit_global_command(command_id, params)
Lingo.delete_global_command(command_id)
Lingo.sync_global_commands(commands)Guild Commands
Lingo.list_guild_commands(guild_id)
Lingo.get_guild_command(guild_id, command_id)
Lingo.create_guild_command(guild_id, params)
Lingo.edit_guild_command(guild_id, command_id, params)
Lingo.delete_guild_command(guild_id, command_id)
Lingo.sync_guild_commands(guild_id, commands)Command Permissions
Lingo.list_command_permissions(guild_id)
Lingo.get_command_permissions(guild_id, command_id)