Module: Rubycord::API::Application
- Defined in:
- lib/rubycord/api/application.rb
Overview
API calls for slash commands.
Class Method Summary collapse
-
.batch_edit_command_permissions(token, application_id, guild_id, permissions) ⇒ Object
Edit permissions for all commands in a guild.
-
.bulk_overwrite_global_commands(token, application_id, commands) ⇒ Object
Set global application commands in bulk.
-
.bulk_overwrite_guild_commands(token, application_id, guild_id, commands) ⇒ Object
Set guild commands in bulk.
-
.create_global_command(token, application_id, name, description, options = [], default_permission = nil, type = 1) ⇒ Object
Create a global application command.
-
.create_guild_command(token, application_id, guild_id, name, description, options = nil, default_permission = nil, type = 1) ⇒ Object
Create an application command for a guild.
-
.delete_global_command(token, application_id, command_id) ⇒ Object
Delete a global application command.
-
.delete_guild_command(token, application_id, guild_id, command_id) ⇒ Object
Delete an application command for a guild.
-
.edit_global_command(token, application_id, command_id, name = nil, description = nil, options = nil, default_permission = nil, type = 1) ⇒ Object
Edit a global application command.
-
.edit_guild_command(token, application_id, guild_id, command_id, name = nil, description = nil, options = nil, default_permission = nil, type = 1) ⇒ Object
Edit an application command for a guild.
-
.edit_guild_command_permissions(token, application_id, guild_id, command_id, permissions) ⇒ Object
Edit the permissions for a specific guild command.
-
.get_global_command(token, application_id, command_id) ⇒ Object
Get a global application command by ID.
-
.get_global_commands(token, application_id) ⇒ Object
Get a list of global application commands.
-
.get_guild_command(token, application_id, guild_id, command_id) ⇒ Object
Get a guild command by ID.
-
.get_guild_command_permissions(token, application_id, guild_id) ⇒ Object
Get the permissions for a specific guild command.
-
.get_guild_commands(token, application_id, guild_id) ⇒ Object
Get a guild's commands for an application.
Class Method Details
.batch_edit_command_permissions(token, application_id, guild_id, permissions) ⇒ Object
Edit permissions for all commands in a guild. https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/rubycord/api/application.rb', line 189 def (token, application_id, guild_id, ) Rubycord::API.request( :applications_aid_guilds_gid_commands_cid_permissions, guild_id, :put, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/permissions", .to_json, Authorization: token, content_type: :json ) end |
.bulk_overwrite_global_commands(token, application_id, commands) ⇒ Object
Set global application commands in bulk. https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rubycord/api/application.rb', line 71 def bulk_overwrite_global_commands(token, application_id, commands) Rubycord::API.request( :applications_aid_commands, nil, :put, "#{Rubycord::API.api_base}/applications/#{application_id}/commands", commands.to_json, Authorization: token, content_type: :json ) end |
.bulk_overwrite_guild_commands(token, application_id, guild_id, commands) ⇒ Object
Set guild commands in bulk. https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-guild-application-commands
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/rubycord/api/application.rb', line 149 def bulk_overwrite_guild_commands(token, application_id, guild_id, commands) Rubycord::API.request( :applications_aid_guilds_gid_commands, guild_id, :put, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", commands.to_json, Authorization: token, content_type: :json ) end |
.create_global_command(token, application_id, name, description, options = [], default_permission = nil, type = 1) ⇒ Object
Create a global application command. https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rubycord/api/application.rb', line 31 def create_global_command(token, application_id, name, description, = [], = nil, type = 1) Rubycord::API.request( :applications_aid_commands, nil, :post, "#{Rubycord::API.api_base}/applications/#{application_id}/commands", {name: name, description: description, options: , default_permission: , type: type}.to_json, Authorization: token, content_type: :json ) end |
.create_guild_command(token, application_id, guild_id, name, description, options = nil, default_permission = nil, type = 1) ⇒ Object
Create an application command for a guild. https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/rubycord/api/application.rb', line 109 def create_guild_command(token, application_id, guild_id, name, description, = nil, = nil, type = 1) Rubycord::API.request( :applications_aid_guilds_gid_commands, guild_id, :post, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", {name: name, description: description, options: , default_permission: , type: type}.to_json, Authorization: token, content_type: :json ) end |
.delete_global_command(token, application_id, command_id) ⇒ Object
Delete a global application command. https://discord.com/developers/docs/interactions/slash-commands#delete-global-application-command
59 60 61 62 63 64 65 66 67 |
# File 'lib/rubycord/api/application.rb', line 59 def delete_global_command(token, application_id, command_id) Rubycord::API.request( :applications_aid_commands_cid, nil, :delete, "#{Rubycord::API.api_base}/applications/#{application_id}/commands/#{command_id}", Authorization: token ) end |
.delete_guild_command(token, application_id, guild_id, command_id) ⇒ Object
Delete an application command for a guild. https://discord.com/developers/docs/interactions/slash-commands#delete-guild-application-command
137 138 139 140 141 142 143 144 145 |
# File 'lib/rubycord/api/application.rb', line 137 def delete_guild_command(token, application_id, guild_id, command_id) Rubycord::API.request( :applications_aid_guilds_gid_commands_cid, guild_id, :delete, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}", Authorization: token ) end |
.edit_global_command(token, application_id, command_id, name = nil, description = nil, options = nil, default_permission = nil, type = 1) ⇒ Object
Edit a global application command. https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rubycord/api/application.rb', line 45 def edit_global_command(token, application_id, command_id, name = nil, description = nil, = nil, = nil, type = 1) Rubycord::API.request( :applications_aid_commands_cid, nil, :patch, "#{Rubycord::API.api_base}/applications/#{application_id}/commands/#{command_id}", {name: name, description: description, options: , default_permission: , type: type}.compact.to_json, Authorization: token, content_type: :json ) end |
.edit_guild_command(token, application_id, guild_id, command_id, name = nil, description = nil, options = nil, default_permission = nil, type = 1) ⇒ Object
Edit an application command for a guild. https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/rubycord/api/application.rb', line 123 def edit_guild_command(token, application_id, guild_id, command_id, name = nil, description = nil, = nil, = nil, type = 1) Rubycord::API.request( :applications_aid_guilds_gid_commands_cid, guild_id, :patch, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}", {name: name, description: description, options: , default_permission: , type: type}.compact.to_json, Authorization: token, content_type: :json ) end |
.edit_guild_command_permissions(token, application_id, guild_id, command_id, permissions) ⇒ Object
Edit the permissions for a specific guild command. https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/rubycord/api/application.rb', line 175 def (token, application_id, guild_id, command_id, ) Rubycord::API.request( :applications_aid_guilds_gid_commands_cid_permissions, guild_id, :put, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions", {permissions: }.to_json, Authorization: token, content_type: :json ) end |
.get_global_command(token, application_id, command_id) ⇒ Object
Get a global application command by ID. https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command
19 20 21 22 23 24 25 26 27 |
# File 'lib/rubycord/api/application.rb', line 19 def get_global_command(token, application_id, command_id) Rubycord::API.request( :applications_aid_commands_cid, nil, :get, "#{Rubycord::API.api_base}/applications/#{application_id}/commands/#{command_id}", Authorization: token ) end |
.get_global_commands(token, application_id) ⇒ Object
Get a list of global application commands. https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
7 8 9 10 11 12 13 14 15 |
# File 'lib/rubycord/api/application.rb', line 7 def get_global_commands(token, application_id) Rubycord::API.request( :applications_aid_commands, nil, :get, "#{Rubycord::API.api_base}/applications/#{application_id}/commands", Authorization: token ) end |
.get_guild_command(token, application_id, guild_id, command_id) ⇒ Object
Get a guild command by ID. https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command
97 98 99 100 101 102 103 104 105 |
# File 'lib/rubycord/api/application.rb', line 97 def get_guild_command(token, application_id, guild_id, command_id) Rubycord::API.request( :applications_aid_guilds_gid_commands_cid, guild_id, :get, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}", Authorization: token ) end |
.get_guild_command_permissions(token, application_id, guild_id) ⇒ Object
Get the permissions for a specific guild command. https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
163 164 165 166 167 168 169 170 171 |
# File 'lib/rubycord/api/application.rb', line 163 def (token, application_id, guild_id) Rubycord::API.request( :applications_aid_guilds_gid_commands_permissions, guild_id, :get, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/permissions", Authorization: token ) end |
.get_guild_commands(token, application_id, guild_id) ⇒ Object
Get a guild's commands for an application. https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
85 86 87 88 89 90 91 92 93 |
# File 'lib/rubycord/api/application.rb', line 85 def get_guild_commands(token, application_id, guild_id) Rubycord::API.request( :applications_aid_guilds_gid_commands, guild_id, :get, "#{Rubycord::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", Authorization: token ) end |