Module: OnyxCord::REST::Application
- Defined in:
- lib/onyxcord/rest/routes/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_application_emoji(token, application_id, name, image) ⇒ Object
Create an application emoji.
-
.create_global_command(token, application_id, name, description, options = [], default_permission = nil, type = 1, default_member_permissions = nil, contexts = nil, nsfw = false, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ Object
Create a global application command.
-
.create_guild_command(token, application_id, guild_id, name, description, options = nil, default_permission = nil, type = 1, default_member_permissions = nil, contexts = nil, nsfw = false, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ Object
Create an application command for a guild.
-
.delete_application_emoji(token, application_id, emoji_id) ⇒ Object
Delete an application emoji.
-
.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_application_emoji(token, application_id, emoji_id, name) ⇒ Object
Edit an application emoji.
-
.edit_global_command(token, application_id, command_id, name = nil, description = nil, options = nil, default_permission = nil, type = 1, default_member_permissions = nil, contexts = nil, nsfw = nil, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ 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, default_member_permissions = nil, contexts = nil, nsfw = nil, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ 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_application_command_permissions(token, application_id, guild_id, command_id) ⇒ Object
Get the permissions for a specific command in a guild.
-
.get_application_emoji(token, application_id, emoji_id) ⇒ Object
Get an application emoji by ID.
-
.get_application_role_connection_metadata_records(token, application_id) ⇒ Object
Get a list of role connection metadata records.
-
.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_application_command_permissions(token, application_id, guild_id) ⇒ Object
Get all of the permissions for the commands in a guild.
-
.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.
-
.list_application_emojis(token, application_id) ⇒ Object
Get a list of application emojis.
-
.set_application_role_connection_metadata_records(token, application_id, metadata) ⇒ Object
Update the role connection metadata records for the application.
-
.update_current_application(token, custom_install_url: :undef, description: :undef, role_connections_verification_url: :undef, install_params: :undef, integration_types_config: :undef, flags: :undef, interactions_endpoint_url: :undef, tags: :undef, event_webhooks_url: :undef, event_webhooks_status: :undef, event_webhooks_types: :undef, icon: :undef, cover_image: :undef) ⇒ Object
Edit the current application for the requesting bot user.
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
199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/onyxcord/rest/routes/application.rb', line 199 def (token, application_id, guild_id, ) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_cid_permissions, guild_id, :put, "#{OnyxCord::REST.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
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/onyxcord/rest/routes/application.rb', line 77 def bulk_overwrite_global_commands(token, application_id, commands) OnyxCord::REST.request( :applications_aid_commands, nil, :put, "#{OnyxCord::REST.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
159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/onyxcord/rest/routes/application.rb', line 159 def bulk_overwrite_guild_commands(token, application_id, guild_id, commands) OnyxCord::REST.request( :applications_aid_guilds_gid_commands, guild_id, :put, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", commands.to_json, Authorization: token, content_type: :json ) end |
.create_application_emoji(token, application_id, name, image) ⇒ Object
Create an application emoji. https://discord.com/developers/docs/resources/emoji#create-application-emoji
261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/onyxcord/rest/routes/application.rb', line 261 def create_application_emoji(token, application_id, name, image) OnyxCord::REST.request( :applications_aid_emojis, application_id, :post, "#{OnyxCord::REST.api_base}/applications/#{application_id}/emojis", { name: name, image: image }.to_json, Authorization: token, content_type: :json ) end |
.create_global_command(token, application_id, name, description, options = [], default_permission = nil, type = 1, default_member_permissions = nil, contexts = nil, nsfw = false, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ Object
Create a global application command. https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/onyxcord/rest/routes/application.rb', line 33 def create_global_command(token, application_id, name, description, = [], = nil, type = 1, = nil, contexts = nil, nsfw = false, integration_types = nil, name_localizations: nil, description_localizations: nil) OnyxCord::REST.request( :applications_aid_commands, nil, :post, "#{OnyxCord::REST.api_base}/applications/#{application_id}/commands", { name: name, description: description, options: , default_permission: , type: type, default_member_permissions: , contexts: contexts, nsfw: nsfw, integration_types: integration_types, name_localizations: name_localizations, description_localizations: description_localizations }.compact.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, default_member_permissions = nil, contexts = nil, nsfw = false, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ Object
Create an application command for a guild. https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/onyxcord/rest/routes/application.rb', line 115 def create_guild_command(token, application_id, guild_id, name, description, = nil, = nil, type = 1, = nil, contexts = nil, nsfw = false, integration_types = nil, name_localizations: nil, description_localizations: nil) OnyxCord::REST.request( :applications_aid_guilds_gid_commands, guild_id, :post, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", { name: name, description: description, options: , default_permission: , type: type, default_member_permissions: , contexts: contexts, nsfw: nsfw, integration_types: integration_types, name_localizations: name_localizations, description_localizations: description_localizations }.compact.to_json, Authorization: token, content_type: :json ) end |
.delete_application_emoji(token, application_id, emoji_id) ⇒ Object
Delete an application emoji. https://discord.com/developers/docs/resources/emoji#delete-application-emoji
289 290 291 292 293 294 295 296 297 |
# File 'lib/onyxcord/rest/routes/application.rb', line 289 def delete_application_emoji(token, application_id, emoji_id) OnyxCord::REST.request( :applications_aid_emojis_eid, application_id, :delete, "#{OnyxCord::REST.api_base}/applications/#{application_id}/emojis/#{emoji_id}", Authorization: token ) 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
65 66 67 68 69 70 71 72 73 |
# File 'lib/onyxcord/rest/routes/application.rb', line 65 def delete_global_command(token, application_id, command_id) OnyxCord::REST.request( :applications_aid_commands_cid, nil, :delete, "#{OnyxCord::REST.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
147 148 149 150 151 152 153 154 155 |
# File 'lib/onyxcord/rest/routes/application.rb', line 147 def delete_guild_command(token, application_id, guild_id, command_id) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_cid, guild_id, :delete, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}", Authorization: token ) end |
.edit_application_emoji(token, application_id, emoji_id, name) ⇒ Object
Edit an application emoji. https://discord.com/developers/docs/resources/emoji#modify-application-emoji
275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/onyxcord/rest/routes/application.rb', line 275 def edit_application_emoji(token, application_id, emoji_id, name) OnyxCord::REST.request( :applications_aid_emojis_eid, application_id, :patch, "#{OnyxCord::REST.api_base}/applications/#{application_id}/emojis/#{emoji_id}", { name: name }.to_json, Authorization: token, content_type: :json ) end |
.edit_global_command(token, application_id, command_id, name = nil, description = nil, options = nil, default_permission = nil, type = 1, default_member_permissions = nil, contexts = nil, nsfw = nil, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ Object
Edit a global application command. https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/onyxcord/rest/routes/application.rb', line 49 def edit_global_command(token, application_id, command_id, name = nil, description = nil, = nil, = nil, type = 1, = nil, contexts = nil, nsfw = nil, integration_types = nil, name_localizations: nil, description_localizations: nil) OnyxCord::REST.request( :applications_aid_commands_cid, nil, :patch, "#{OnyxCord::REST.api_base}/applications/#{application_id}/commands/#{command_id}", { name: name, description: description, options: , default_permission: , type: type, default_member_permissions: , contexts: contexts, nsfw: nsfw, integration_types: integration_types, name_localizations: name_localizations, description_localizations: description_localizations }.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, default_member_permissions = nil, contexts = nil, nsfw = nil, integration_types = nil, name_localizations: nil, description_localizations: nil) ⇒ Object
Edit an application command for a guild. https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/onyxcord/rest/routes/application.rb', line 131 def edit_guild_command(token, application_id, guild_id, command_id, name = nil, description = nil, = nil, = nil, type = 1, = nil, contexts = nil, nsfw = nil, integration_types = nil, name_localizations: nil, description_localizations: nil) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_cid, guild_id, :patch, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}", { name: name, description: description, options: , default_permission: , type: type, default_member_permissions: , contexts: contexts, nsfw: nsfw, integration_types: integration_types, name_localizations: name_localizations, description_localizations: description_localizations }.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
185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/onyxcord/rest/routes/application.rb', line 185 def (token, application_id, guild_id, command_id, ) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_cid_permissions, guild_id, :put, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions", { permissions: }.to_json, Authorization: token, content_type: :json ) end |
.get_application_command_permissions(token, application_id, guild_id, command_id) ⇒ Object
Get the permissions for a specific command in a guild. https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
225 226 227 228 229 230 231 232 233 |
# File 'lib/onyxcord/rest/routes/application.rb', line 225 def (token, application_id, guild_id, command_id) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_cid_permissions, guild_id, :get, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions", Authorization: token ) end |
.get_application_emoji(token, application_id, emoji_id) ⇒ Object
Get an application emoji by ID. https://discord.com/developers/docs/resources/emoji#get-application-emoji
249 250 251 252 253 254 255 256 257 |
# File 'lib/onyxcord/rest/routes/application.rb', line 249 def get_application_emoji(token, application_id, emoji_id) OnyxCord::REST.request( :applications_aid_emojis_eid, application_id, :get, "#{OnyxCord::REST.api_base}/applications/#{application_id}/emojis/#{emoji_id}", Authorization: token ) end |
.get_application_role_connection_metadata_records(token, application_id) ⇒ Object
Get a list of role connection metadata records. https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records
315 316 317 318 319 320 321 322 323 |
# File 'lib/onyxcord/rest/routes/application.rb', line 315 def (token, application_id) OnyxCord::REST.request( :applications_aid_role_connections_metadata, nil, :get, "#{OnyxCord::REST.api_base}/applications/#{application_id}/role-connections/metadata", Authorization: token ) 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
21 22 23 24 25 26 27 28 29 |
# File 'lib/onyxcord/rest/routes/application.rb', line 21 def get_global_command(token, application_id, command_id) OnyxCord::REST.request( :applications_aid_commands_cid, nil, :get, "#{OnyxCord::REST.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
9 10 11 12 13 14 15 16 17 |
# File 'lib/onyxcord/rest/routes/application.rb', line 9 def get_global_commands(token, application_id) OnyxCord::REST.request( :applications_aid_commands, nil, :get, "#{OnyxCord::REST.api_base}/applications/#{application_id}/commands", Authorization: token ) end |
.get_guild_application_command_permissions(token, application_id, guild_id) ⇒ Object
Get all of the permissions for the commands in a guild. https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
213 214 215 216 217 218 219 220 221 |
# File 'lib/onyxcord/rest/routes/application.rb', line 213 def (token, application_id, guild_id) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_permissions, guild_id, :get, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands/permissions", 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
103 104 105 106 107 108 109 110 111 |
# File 'lib/onyxcord/rest/routes/application.rb', line 103 def get_guild_command(token, application_id, guild_id, command_id) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_cid, guild_id, :get, "#{OnyxCord::REST.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
173 174 175 176 177 178 179 180 181 |
# File 'lib/onyxcord/rest/routes/application.rb', line 173 def (token, application_id, guild_id) OnyxCord::REST.request( :applications_aid_guilds_gid_commands_permissions, guild_id, :get, "#{OnyxCord::REST.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
91 92 93 94 95 96 97 98 99 |
# File 'lib/onyxcord/rest/routes/application.rb', line 91 def get_guild_commands(token, application_id, guild_id) OnyxCord::REST.request( :applications_aid_guilds_gid_commands, guild_id, :get, "#{OnyxCord::REST.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", Authorization: token ) end |
.list_application_emojis(token, application_id) ⇒ Object
Get a list of application emojis. https://discord.com/developers/docs/resources/emoji#list-application-emojis
237 238 239 240 241 242 243 244 245 |
# File 'lib/onyxcord/rest/routes/application.rb', line 237 def list_application_emojis(token, application_id) OnyxCord::REST.request( :applications_aid_emojis, application_id, :get, "#{OnyxCord::REST.api_base}/applications/#{application_id}/emojis", Authorization: token ) end |
.set_application_role_connection_metadata_records(token, application_id, metadata) ⇒ Object
Update the role connection metadata records for the application. https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records
327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/onyxcord/rest/routes/application.rb', line 327 def (token, application_id, ) OnyxCord::REST.request( :applications_aid_role_connections_metadata, nil, :put, "#{OnyxCord::REST.api_base}/applications/#{application_id}/role-connections/metadata", .to_json, Authorization: token, content_type: :json ) end |
.update_current_application(token, custom_install_url: :undef, description: :undef, role_connections_verification_url: :undef, install_params: :undef, integration_types_config: :undef, flags: :undef, interactions_endpoint_url: :undef, tags: :undef, event_webhooks_url: :undef, event_webhooks_status: :undef, event_webhooks_types: :undef, icon: :undef, cover_image: :undef) ⇒ Object
Edit the current application for the requesting bot user. https://discord.com/developers/docs/resources/application#edit-current-application
301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/onyxcord/rest/routes/application.rb', line 301 def update_current_application(token, custom_install_url: :undef, description: :undef, role_connections_verification_url: :undef, install_params: :undef, integration_types_config: :undef, flags: :undef, interactions_endpoint_url: :undef, tags: :undef, event_webhooks_url: :undef, event_webhooks_status: :undef, event_webhooks_types: :undef, icon: :undef, cover_image: :undef) OnyxCord::REST.request( :applications_me, nil, :patch, "#{OnyxCord::REST.api_base}/applications/@me", { custom_install_url:, description:, role_connections_verification_url:, install_params:, integration_types_config:, flags:, interactions_endpoint_url:, tags:, event_webhooks_url:, event_webhooks_status:, event_webhooks_types:, icon:, cover_image: }.reject { |_, value| value == :undef }.to_json, Authorization: token, content_type: :json ) end |