Module: Discordrb::API::Application
- Defined in:
- lib/discordrb/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, default_member_permissions = nil, contexts = 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) ⇒ 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, default_member_permissions = nil, contexts = 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) ⇒ 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
191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/discordrb/api/application.rb', line 191 def (token, application_id, guild_id, ) Discordrb::API.request( :applications_aid_guilds_gid_commands_cid_permissions, guild_id, :put, "#{Discordrb::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
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/discordrb/api/application.rb', line 73 def bulk_overwrite_global_commands(token, application_id, commands) Discordrb::API.request( :applications_aid_commands, nil, :put, "#{Discordrb::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
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/discordrb/api/application.rb', line 151 def bulk_overwrite_guild_commands(token, application_id, guild_id, commands) Discordrb::API.request( :applications_aid_guilds_gid_commands, guild_id, :put, "#{Discordrb::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, default_member_permissions = nil, contexts = 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 |
# File 'lib/discordrb/api/application.rb', line 33 def create_global_command(token, application_id, name, description, = [], = nil, type = 1, = nil, contexts = nil) Discordrb::API.request( :applications_aid_commands, nil, :post, "#{Discordrb::API.api_base}/applications/#{application_id}/commands", { name: name, description: description, options: , default_permission: , type: type, default_member_permissions: , contexts: contexts }.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) ⇒ Object
Create an application command for a guild. https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/discordrb/api/application.rb', line 111 def create_guild_command(token, application_id, guild_id, name, description, = nil, = nil, type = 1, = nil, contexts = nil) Discordrb::API.request( :applications_aid_guilds_gid_commands, guild_id, :post, "#{Discordrb::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", { name: name, description: description, options: , default_permission: , type: type, default_member_permissions: , contexts: contexts }.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
61 62 63 64 65 66 67 68 69 |
# File 'lib/discordrb/api/application.rb', line 61 def delete_global_command(token, application_id, command_id) Discordrb::API.request( :applications_aid_commands_cid, nil, :delete, "#{Discordrb::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
139 140 141 142 143 144 145 146 147 |
# File 'lib/discordrb/api/application.rb', line 139 def delete_guild_command(token, application_id, guild_id, command_id) Discordrb::API.request( :applications_aid_guilds_gid_commands_cid, guild_id, :delete, "#{Discordrb::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, default_member_permissions = nil, contexts = nil) ⇒ Object
Edit a global application command. https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/discordrb/api/application.rb', line 47 def edit_global_command(token, application_id, command_id, name = nil, description = nil, = nil, = nil, type = 1, = nil, contexts = nil) Discordrb::API.request( :applications_aid_commands_cid, nil, :patch, "#{Discordrb::API.api_base}/applications/#{application_id}/commands/#{command_id}", { name: name, description: description, options: , default_permission: , type: type, default_member_permissions: , contexts: contexts }.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) ⇒ Object
Edit an application command for a guild. https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/discordrb/api/application.rb', line 125 def edit_guild_command(token, application_id, guild_id, command_id, name = nil, description = nil, = nil, = nil, type = 1, = nil, contexts = nil) Discordrb::API.request( :applications_aid_guilds_gid_commands_cid, guild_id, :patch, "#{Discordrb::API.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 }.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
177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/discordrb/api/application.rb', line 177 def (token, application_id, guild_id, command_id, ) Discordrb::API.request( :applications_aid_guilds_gid_commands_cid_permissions, guild_id, :put, "#{Discordrb::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
21 22 23 24 25 26 27 28 29 |
# File 'lib/discordrb/api/application.rb', line 21 def get_global_command(token, application_id, command_id) Discordrb::API.request( :applications_aid_commands_cid, nil, :get, "#{Discordrb::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
9 10 11 12 13 14 15 16 17 |
# File 'lib/discordrb/api/application.rb', line 9 def get_global_commands(token, application_id) Discordrb::API.request( :applications_aid_commands, nil, :get, "#{Discordrb::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
99 100 101 102 103 104 105 106 107 |
# File 'lib/discordrb/api/application.rb', line 99 def get_guild_command(token, application_id, guild_id, command_id) Discordrb::API.request( :applications_aid_guilds_gid_commands_cid, guild_id, :get, "#{Discordrb::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
165 166 167 168 169 170 171 172 173 |
# File 'lib/discordrb/api/application.rb', line 165 def (token, application_id, guild_id) Discordrb::API.request( :applications_aid_guilds_gid_commands_permissions, guild_id, :get, "#{Discordrb::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
87 88 89 90 91 92 93 94 95 |
# File 'lib/discordrb/api/application.rb', line 87 def get_guild_commands(token, application_id, guild_id) Discordrb::API.request( :applications_aid_guilds_gid_commands, guild_id, :get, "#{Discordrb::API.api_base}/applications/#{application_id}/guilds/#{guild_id}/commands", Authorization: token ) end |