diff --git a/lib/discordrb/api/application.rb b/lib/discordrb/api/application.rb index a3ccc7170..64bac9173 100644 --- a/lib/discordrb/api/application.rb +++ b/lib/discordrb/api/application.rb @@ -6,12 +6,15 @@ module Discordrb::API::Application # Get a list of global application commands. # https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands - def get_global_commands(token, application_id) + def get_global_commands(token, application_id, with_localizations: nil) Discordrb::API.request( :applications_aid_commands, nil, :get, - "#{Discordrb::API.api_base}/applications/#{application_id}/commands", + Discordrb::API.uri_with_query( + "#{Discordrb::API.api_base}/applications/#{application_id}/commands", + { with_localizations?: with_localizations } + ), Authorization: token ) end @@ -84,12 +87,15 @@ def bulk_overwrite_global_commands(token, application_id, commands) # Get a guild's commands for an application. # https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands - def get_guild_commands(token, application_id, guild_id) + def get_guild_commands(token, application_id, guild_id, with_localizations: nil) Discordrb::API.request( :applications_aid_guilds_gid_commands, guild_id, :get, - "#{Discordrb::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", + Discordrb::API.uri_with_query( + "#{Discordrb::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", + { with_localizations?: with_localizations } + ), Authorization: token ) end diff --git a/lib/discordrb/bot.rb b/lib/discordrb/bot.rb index 664aad982..19f462d58 100644 --- a/lib/discordrb/bot.rb +++ b/lib/discordrb/bot.rb @@ -792,12 +792,13 @@ def prune_empty_groups # Get all application commands. # @param server_id [String, Integer, nil] The ID of the server to get the commands from. Global if `nil`. + # @param with_localizations [true, false] Whether the full localizations of commands should be included in the result. # @return [Array] - def get_application_commands(server_id: nil) + def get_application_commands(server_id: nil, with_localizations: nil) resp = if server_id - API::Application.get_guild_commands(@token, profile.id, server_id) + API::Application.get_guild_commands(@token, profile.id, server_id, with_localizations: with_localizations) else - API::Application.get_global_commands(@token, profile.id) + API::Application.get_global_commands(@token, profile.id, with_localizations: with_localizations) end JSON.parse(resp).map do |command_data|