Class: LibDiscord::ApplicationCommand

Inherits:
Resource
  • Object
show all
Defined in:
lib/lib_discord/application_command.rb

Overview

Application Commands

Do not instantiate an ApplicationCommand directly. Instead request one from an instance of Client.

client = LibDiscord::Client.new("Bot auth.token")
a = client["application_command"]

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from LibDiscord::Resource

Instance Method Details

#batch_edit_application_command_permissions(application_id:, guild_id:, json:) ⇒ Response

Deprecated.

This endpoint has been disabled with updates to command permissions (Permissions v2). Instead, you can edit each application command permissions (though you should be careful to handle any potential rate limits).

Parameters:

Returns:

Raises:

See Also:



337
338
339
# File 'lib/lib_discord/application_command.rb', line 337

def batch_edit_application_command_permissions(application_id:, guild_id:, json:)
  send_request(:put, "/applications/#{application_id}/guilds/#{guild_id}/commands/permissions", json:)
end

#bulk_overwrite_global_application_commands(application_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



124
125
126
# File 'lib/lib_discord/application_command.rb', line 124

def bulk_overwrite_global_application_commands(application_id:, json:)
  send_request(:put, "/applications/#{application_id}/commands", json:)
end

#bulk_overwrite_guild_application_commands(application_id:, guild_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



250
251
252
# File 'lib/lib_discord/application_command.rb', line 250

def bulk_overwrite_guild_application_commands(application_id:, guild_id:, json:)
  send_request(:put, "/applications/#{application_id}/guilds/#{guild_id}/commands", json:)
end

#create_global_application_command(application_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



51
52
53
# File 'lib/lib_discord/application_command.rb', line 51

def create_global_application_command(application_id:, json:)
  send_request(:post, "/applications/#{application_id}/commands", json:)
end

#create_guild_application_command(application_id:, guild_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



165
166
167
# File 'lib/lib_discord/application_command.rb', line 165

def create_guild_application_command(application_id:, guild_id:, json:)
  send_request(:post, "/applications/#{application_id}/guilds/#{guild_id}/commands", json:)
end

#delete_global_application_command(application_id:, command_id:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



107
108
109
# File 'lib/lib_discord/application_command.rb', line 107

def delete_global_application_command(application_id:, command_id:)
  send_request(:delete, "/applications/#{application_id}/commands/#{command_id}")
end

#delete_guild_application_command(application_id:, guild_id:, command_id:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



230
231
232
# File 'lib/lib_discord/application_command.rb', line 230

def delete_guild_application_command(application_id:, guild_id:, command_id:)
  send_request(:delete, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}")
end

#edit_application_command_permissions(application_id:, guild_id:, command_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



310
311
312
# File 'lib/lib_discord/application_command.rb', line 310

def edit_application_command_permissions(application_id:, guild_id:, command_id:, json:)
  send_request(:put, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions", json:)
end

#edit_global_application_command(application_id:, command_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



89
90
91
# File 'lib/lib_discord/application_command.rb', line 89

def edit_global_application_command(application_id:, command_id:, json:)
  send_request(:patch, "/applications/#{application_id}/commands/#{command_id}", json:)
end

#edit_guild_application_command(application_id:, guild_id:, command_id:, json:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



209
210
211
# File 'lib/lib_discord/application_command.rb', line 209

def edit_guild_application_command(application_id:, guild_id:, command_id:, json:)
  send_request(:patch, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}", json:)
end

#get_application_command_permissions(application_id:, guild_id:, command_id:) ⇒ Object

Parameters:

Raises:

See Also:



287
288
289
# File 'lib/lib_discord/application_command.rb', line 287

def get_application_command_permissions(application_id:, guild_id:, command_id:)
  send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions")
end

#get_global_application_command(application_id:, command_id:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



69
70
71
# File 'lib/lib_discord/application_command.rb', line 69

def get_global_application_command(application_id:, command_id:)
  send_request(:get, "/applications/#{application_id}/commands/#{command_id}")
end

#get_global_application_commands(application_id:, params: {}) ⇒ Response

Parameters:

Returns:

Raises:

  • (TimeoutError)

    if the HTTP request times out

  • (ConstraintError)

    if params cannot be coerced into a valid query parameters string

See Also:



34
35
36
# File 'lib/lib_discord/application_command.rb', line 34

def get_global_application_commands(application_id:, params: {})
  send_request(:get, "/applications/#{application_id}/commands", params:)
end

#get_guild_application_command(application_id:, guild_id:, command_id:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



186
187
188
# File 'lib/lib_discord/application_command.rb', line 186

def get_guild_application_command(application_id:, guild_id:, command_id:)
  send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}")
end

#get_guild_application_command_permissions(application_id:, guild_id:) ⇒ Response

Parameters:

Returns:

Raises:

See Also:



268
269
270
# File 'lib/lib_discord/application_command.rb', line 268

def get_guild_application_command_permissions(application_id:, guild_id:)
  send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands/permissions")
end

#get_guild_application_commands(application_id:, guild_id:, params: {}) ⇒ Response

Parameters:

Returns:

Raises:

  • (TimeoutError)

    if the HTTP request times outs

  • (ConstraintError)

    if params cannot be coerced into a valid query parameters string

See Also:



145
146
147
# File 'lib/lib_discord/application_command.rb', line 145

def get_guild_application_commands(application_id:, guild_id:, params: {})
  send_request(:get, "/applications/#{application_id}/guilds/#{guild_id}/commands", params:)
end