Class: LibDiscord::Client

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

Overview

You will mainly be interacting with instances of this class when using lib_discord to access Discord’s web API. Initialize a client and cache it for as long as you need to make requests to Discord using a given authorization header.

require "lib_discord"
client = LibDiscord::Client.new("Bot my.amazing.token")

Instance Method Summary collapse

Constructor Details

#initialize(auth = nil, user_agent: "LibDiscord (#{LibDiscord::PROJECT_URL}, #{LibDiscord.version})", logger: nil) ⇒ self

Examples:

hook in your own logger and app-specific user-agent

client = LibDiscord::Client.new(
  "Bot my.token",
  user_agent: "MyApp (https://example.myapp.com, 1.2.3)",
  logger: my_logger
)

Suppress all stdout logger output.

client = LibDiscord::Client.new(
  "Bot my.token",
  logger: Logger.new("/dev/null")
)

Make a request to a public endpoint.

client = LibDiscord::Client.new
client.get_gateway # => LibDiscord::Response

Parameters:

  • auth (String) (defaults to: nil)

    Authorization header value to be used in communication with Discord. In the format Bot <token> or Bearer <token>. If you intend only to make requests to unauthenticated endpoints, auth is not necessary.

  • user_agent (String) (defaults to: "LibDiscord (#{LibDiscord::PROJECT_URL}, #{LibDiscord.version})")

    User-Agent header value to use in requests to Discord.

  • logger (#debug, #info, #warn, #error, #fatal) (defaults to: nil)

    Logger to use for output messages. If not provided, a basic INFO-level $stdout logger is created for internal use ( l = Logger.new($stdout); l.level = :info ). CAUTION: a DEBUG level logger in production will leak sensitive data including authorization headers.

See Also:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/lib_discord/client.rb', line 61

def initialize(
  auth = nil,
  user_agent: "LibDiscord (#{LibDiscord::PROJECT_URL}, #{LibDiscord.version})",
  logger: nil
)
  @default_headers = {
    "User-Agent" => user_agent,
    "Authorization" => auth
  }.compact

  @logger = logger
  unless @logger
    @logger = Logger.new($stdout)
    @logger.level = :info
  end
end

Instance Method Details

#add_guild_member(guild_id, user_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1914
1915
1916
1917
1918
1919
1920
1921
# File 'lib/lib_discord/client.rb', line 1914

def add_guild_member(guild_id, user_id, body, reason: nil)
  json_request(
    :put,
    discord("/guilds/#{guild_id}/members/#{user_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#add_guild_member_role(guild_id, user_id, role_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • role_id (#to_s)

    Role ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1986
1987
1988
1989
1990
1991
1992
# File 'lib/lib_discord/client.rb', line 1986

def add_guild_member_role(guild_id, user_id, role_id, reason: nil)
  json_request(
    :put,
    discord("/guilds/#{guild_id}/members/#{user_id}/roles/#{role_id}"),
    headers: auditlog(reason)
  )
end

#add_member_to_lobby(lobby_id, user_id, body, reason: nil) ⇒ Response

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • user_id (#to_s)

    User ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2594
2595
2596
2597
2598
2599
2600
2601
# File 'lib/lib_discord/client.rb', line 2594

def add_member_to_lobby(lobby_id, user_id, body, reason: nil)
  json_request(
    :put,
    discord("/lobbies/#{lobby_id}/members/#{user_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#add_thread_member(channel_id, user_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1105
1106
1107
1108
1109
1110
1111
# File 'lib/lib_discord/client.rb', line 1105

def add_thread_member(channel_id, user_id, reason: nil)
  json_request(
    :put,
    discord("/channels/#{channel_id}/thread-members/#{user_id}"),
    headers: auditlog(reason)
  )
end

#batch_edit_application_command_permissions(application_id, guild_id, body, reason: nil) ⇒ 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:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



574
575
576
577
578
579
580
581
# File 'lib/lib_discord/client.rb', line 574

def batch_edit_application_command_permissions(application_id, guild_id, body, reason: nil)
  json_request(
    :put,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands/permissions"),
    body:,
    headers: auditlog(reason)
  )
end

#begin_guild_prune(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2252
2253
2254
2255
2256
2257
2258
2259
# File 'lib/lib_discord/client.rb', line 2252

def begin_guild_prune(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/prune"),
    body:,
    headers: auditlog(reason)
  )
end

#bulk_delete_messages(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2882
2883
2884
2885
2886
2887
2888
2889
# File 'lib/lib_discord/client.rb', line 2882

def bulk_delete_messages(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/messages/bulk-delete"),
    body:,
    headers: auditlog(reason)
  )
end

#bulk_guild_ban(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2102
2103
2104
2105
2106
2107
2108
2109
# File 'lib/lib_discord/client.rb', line 2102

def bulk_guild_ban(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/bulk-ban"),
    body:,
    headers: auditlog(reason)
  )
end

#bulk_overwrite_global_application_commands(application_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



390
391
392
393
394
395
396
397
# File 'lib/lib_discord/client.rb', line 390

def bulk_overwrite_global_application_commands(application_id, body, reason: nil)
  json_request(
    :put,
    discord("/applications/#{application_id}/commands"),
    body:,
    headers: auditlog(reason)
  )
end

#bulk_overwrite_guild_application_commands(application_id, guild_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



497
498
499
500
501
502
503
504
# File 'lib/lib_discord/client.rb', line 497

def bulk_overwrite_guild_application_commands(application_id, guild_id, body, reason: nil)
  json_request(
    :put,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands"),
    body:,
    headers: auditlog(reason)
  )
end

#consume_entitlement(application_id, entitlement_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • entitlement_id (#to_s)

    Entitlement ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1441
1442
1443
1444
1445
1446
1447
# File 'lib/lib_discord/client.rb', line 1441

def consume_entitlement(application_id, entitlement_id, reason: nil)
  json_request(
    :post,
    discord("/applications/#{application_id}/entitlements/#{entitlement_id}/consume"),
    headers: auditlog(reason)
  )
end

#create_application_emoji(application_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1355
1356
1357
1358
1359
1360
1361
1362
# File 'lib/lib_discord/client.rb', line 1355

def create_application_emoji(application_id, body, reason: nil)
  json_request(
    :post,
    discord("/applications/#{application_id}/emojis"),
    body:,
    headers: auditlog(reason)
  )
end

#create_auto_moderation_rule(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



755
756
757
758
759
760
761
762
# File 'lib/lib_discord/client.rb', line 755

def create_auto_moderation_rule(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/auto-moderation/rules"),
    body:,
    headers: auditlog(reason)
  )
end

#create_channel_invite(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



892
893
894
895
896
897
898
899
# File 'lib/lib_discord/client.rb', line 892

def create_channel_invite(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/invites"),
    body:,
    headers: auditlog(reason)
  )
end

#create_dm(body, reason: nil) ⇒ Response

Parameters:

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3401
3402
3403
3404
3405
3406
3407
3408
# File 'lib/lib_discord/client.rb', line 3401

def create_dm(body, reason: nil)
  json_request(
    :post,
    discord("/users/@me/channels"),
    body:,
    headers: auditlog(reason)
  )
end

#create_followup_message(application_id, interaction_token, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • interaction_token (#to_s)

    Interaction Token

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



232
233
234
235
236
237
238
239
# File 'lib/lib_discord/client.rb', line 232

def create_followup_message(application_id, interaction_token, body, reason: nil)
  json_request(
    :post,
    discord("/webhooks/#{application_id}/#{interaction_token}"),
    body:,
    headers: auditlog(reason)
  )
end

#create_global_application_command(application_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



323
324
325
326
327
328
329
330
# File 'lib/lib_discord/client.rb', line 323

def create_global_application_command(application_id, body, reason: nil)
  json_request(
    :post,
    discord("/applications/#{application_id}/commands"),
    body:,
    headers: auditlog(reason)
  )
end

#create_group_dm(body, reason: nil) ⇒ Response

Parameters:

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3417
3418
3419
3420
3421
3422
3423
3424
# File 'lib/lib_discord/client.rb', line 3417

def create_group_dm(body, reason: nil)
  json_request(
    :post,
    discord("/users/@me/channels"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild(body, reason: nil) ⇒ Response

Parameters:

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1718
1719
1720
1721
1722
1723
1724
1725
# File 'lib/lib_discord/client.rb', line 1718

def create_guild(body, reason: nil)
  json_request(
    :post,
    discord("/guilds"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_application_command(application_id, guild_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



426
427
428
429
430
431
432
433
# File 'lib/lib_discord/client.rb', line 426

def create_guild_application_command(application_id, guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_ban(guild_id, user_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2069
2070
2071
2072
2073
2074
2075
2076
# File 'lib/lib_discord/client.rb', line 2069

def create_guild_ban(guild_id, user_id, body, reason: nil)
  json_request(
    :put,
    discord("/guilds/#{guild_id}/bans/#{user_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_channel(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1814
1815
1816
1817
1818
1819
1820
1821
# File 'lib/lib_discord/client.rb', line 1814

def create_guild_channel(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/channels"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_emoji(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1273
1274
1275
1276
1277
1278
1279
1280
# File 'lib/lib_discord/client.rb', line 1273

def create_guild_emoji(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/emojis"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_from_guild_template(template_code, body, reason: nil) ⇒ Response

Parameters:

  • template_code (#to_s)

    Template Code

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1616
1617
1618
1619
1620
1621
1622
1623
# File 'lib/lib_discord/client.rb', line 1616

def create_guild_from_guild_template(template_code, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/templates/#{template_code}"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_role(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2150
2151
2152
2153
2154
2155
2156
2157
# File 'lib/lib_discord/client.rb', line 2150

def create_guild_role(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/roles"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_scheduled_event(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1510
1511
1512
1513
1514
1515
1516
1517
# File 'lib/lib_discord/client.rb', line 1510

def create_guild_scheduled_event(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/scheduled-events"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_soundboard_sound(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3023
3024
3025
3026
3027
3028
3029
3030
# File 'lib/lib_discord/client.rb', line 3023

def create_guild_soundboard_sound(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/soundboard-sounds"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_sticker(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3220
3221
3222
3223
3224
3225
3226
3227
# File 'lib/lib_discord/client.rb', line 3220

def create_guild_sticker(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/stickers"),
    body:,
    headers: auditlog(reason)
  )
end

#create_guild_template(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1648
1649
1650
1651
1652
1653
1654
1655
# File 'lib/lib_discord/client.rb', line 1648

def create_guild_template(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/templates"),
    body:,
    headers: auditlog(reason)
  )
end

#create_interaction_response(interaction_id, interaction_token, body, reason: nil) ⇒ Response

Parameters:

  • interaction_id (#to_s)

    Interaction ID

  • interaction_token (#to_s)

    Interaction Token

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



164
165
166
167
168
169
170
171
# File 'lib/lib_discord/client.rb', line 164

def create_interaction_response(interaction_id, interaction_token, body, reason: nil)
  json_request(
    :post,
    discord("/interactions/#{interaction_id}/#{interaction_token}/callback"),
    body:,
    headers: auditlog(reason)
  )
end

#create_lobby(body, reason: nil) ⇒ Response

Parameters:

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2529
2530
2531
2532
2533
2534
2535
2536
# File 'lib/lib_discord/client.rb', line 2529

def create_lobby(body, reason: nil)
  json_request(
    :post,
    discord("/lobbies"),
    body:,
    headers: auditlog(reason)
  )
end

#create_message(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2711
2712
2713
2714
2715
2716
2717
2718
# File 'lib/lib_discord/client.rb', line 2711

def create_message(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/messages"),
    body:,
    headers: auditlog(reason)
  )
end

#create_reaction(channel_id, message_id, emoji, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • emoji (#to_s)

    Emoji

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2745
2746
2747
2748
2749
2750
2751
# File 'lib/lib_discord/client.rb', line 2745

def create_reaction(channel_id, message_id, emoji, reason: nil)
  json_request(
    :put,
    discord("/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}/@me"),
    headers: auditlog(reason)
  )
end

#create_stage_instance(body, reason: nil) ⇒ Response

Parameters:

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3077
3078
3079
3080
3081
3082
3083
3084
# File 'lib/lib_discord/client.rb', line 3077

def create_stage_instance(body, reason: nil)
  json_request(
    :post,
    discord("/stage-instances"),
    body:,
    headers: auditlog(reason)
  )
end

#create_test_entitlement(application_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1456
1457
1458
1459
1460
1461
1462
1463
# File 'lib/lib_discord/client.rb', line 1456

def create_test_entitlement(application_id, body, reason: nil)
  json_request(
    :post,
    discord("/applications/#{application_id}/entitlements"),
    body:,
    headers: auditlog(reason)
  )
end

#create_webhook(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3568
3569
3570
3571
3572
3573
3574
3575
# File 'lib/lib_discord/client.rb', line 3568

def create_webhook(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/webhooks"),
    body:,
    headers: auditlog(reason)
  )
end

#crosspost_message(channel_id, message_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2728
2729
2730
2731
2732
2733
2734
# File 'lib/lib_discord/client.rb', line 2728

def crosspost_message(channel_id, message_id, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/messages/#{message_id}/crosspost"),
    headers: auditlog(reason)
  )
end

#delete_all_reactions(channel_id, message_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2815
2816
2817
2818
2819
2820
2821
# File 'lib/lib_discord/client.rb', line 2815

def delete_all_reactions(channel_id, message_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/messages/#{message_id}/reactions"),
    headers: auditlog(reason)
  )
end

#delete_all_reactions_for_emoji(channel_id, message_id, emoji, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • emoji (#to_s)

    Emoji

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2832
2833
2834
2835
2836
2837
2838
# File 'lib/lib_discord/client.rb', line 2832

def delete_all_reactions_for_emoji(channel_id, message_id, emoji, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}"),
    headers: auditlog(reason)
  )
end

#delete_application_emoji(application_id, emoji_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • emoji_id (#to_s)

    Emoji ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1390
1391
1392
1393
1394
1395
1396
# File 'lib/lib_discord/client.rb', line 1390

def delete_application_emoji(application_id, emoji_id, reason: nil)
  json_request(
    :delete,
    discord("/applications/#{application_id}/emojis/#{emoji_id}"),
    headers: auditlog(reason)
  )
end

#delete_auto_moderation_rule(guild_id, auto_moderation_rule_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • auto_moderation_rule_id (#to_s)

    Auto Moderation Rule ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



790
791
792
793
794
795
796
# File 'lib/lib_discord/client.rb', line 790

def delete_auto_moderation_rule(guild_id, auto_moderation_rule_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/auto-moderation/rules/#{auto_moderation_rule_id}"),
    headers: auditlog(reason)
  )
end

#delete_channel(channel_id, reason: nil) ⇒ Response Also known as: close_channel

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



841
842
843
844
845
846
847
# File 'lib/lib_discord/client.rb', line 841

def delete_channel(channel_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}"),
    headers: auditlog(reason)
  )
end

#delete_channel_permission(channel_id, overwrite_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • overwrite_id (#to_s)

    Overwrite ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



909
910
911
912
913
914
915
# File 'lib/lib_discord/client.rb', line 909

def delete_channel_permission(channel_id, overwrite_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/permissions/#{overwrite_id}"),
    headers: auditlog(reason)
  )
end

#delete_followup_message(application_id, interaction_token, message_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • interaction_token (#to_s)

    Interaction Token

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



286
287
288
289
290
291
292
# File 'lib/lib_discord/client.rb', line 286

def delete_followup_message(application_id, interaction_token, message_id, reason: nil)
  json_request(
    :delete,
    discord("/webhooks/#{application_id}/#{interaction_token}/messages/#{message_id}"),
    headers: auditlog(reason)
  )
end

#delete_global_application_command(application_id, command_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • command_id (#to_s)

    Command ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



374
375
376
377
378
379
380
# File 'lib/lib_discord/client.rb', line 374

def delete_global_application_command(application_id, command_id, reason: nil)
  json_request(
    :delete,
    discord("/applications/#{application_id}/commands/#{command_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1783
1784
1785
1786
1787
1788
1789
# File 'lib/lib_discord/client.rb', line 1783

def delete_guild(guild_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}"),
    headers: auditlog(reason)
  )
end

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

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • command_id (#to_s)

    Command ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



480
481
482
483
484
485
486
# File 'lib/lib_discord/client.rb', line 480

def delete_guild_application_command(application_id, guild_id, command_id, reason: nil)
  json_request(
    :delete,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild_emoji(guild_id, emoji_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • emoji_id (#to_s)

    Emoji ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1308
1309
1310
1311
1312
1313
1314
# File 'lib/lib_discord/client.rb', line 1308

def delete_guild_emoji(guild_id, emoji_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/emojis/#{emoji_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild_integration(guild_id, integration_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • integration_id (#to_s)

    Integration ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2314
2315
2316
2317
2318
2319
2320
# File 'lib/lib_discord/client.rb', line 2314

def delete_guild_integration(guild_id, integration_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/integrations/#{integration_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild_role(guild_id, role_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • role_id (#to_s)

    Role ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2219
2220
2221
2222
2223
2224
2225
# File 'lib/lib_discord/client.rb', line 2219

def delete_guild_role(guild_id, role_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/roles/#{role_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild_scheduled_event(guild_id, guild_scheduled_event_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • guild_scheduled_event_id (#to_s)

    Guild Scheduled Event ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1563
1564
1565
1566
1567
1568
1569
# File 'lib/lib_discord/client.rb', line 1563

def delete_guild_scheduled_event(guild_id, guild_scheduled_event_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild_soundboard_sound(guild_id, sound_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • sound_id (#to_s)

    Sound ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3058
3059
3060
3061
3062
3063
3064
# File 'lib/lib_discord/client.rb', line 3058

def delete_guild_soundboard_sound(guild_id, sound_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/soundboard-sounds/#{sound_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild_sticker(guild_id, sticker_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • sticker_id (#to_s)

    Sticker ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3255
3256
3257
3258
3259
3260
3261
# File 'lib/lib_discord/client.rb', line 3255

def delete_guild_sticker(guild_id, sticker_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/stickers/#{sticker_id}"),
    headers: auditlog(reason)
  )
end

#delete_guild_template(guild_id, template_code, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • template_code (#to_s)

    Template Code

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1699
1700
1701
1702
1703
1704
1705
# File 'lib/lib_discord/client.rb', line 1699

def delete_guild_template(guild_id, template_code, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/templates/#{template_code}"),
    headers: auditlog(reason)
  )
end

#delete_invite(invite_code, reason: nil) ⇒ Response

Parameters:

  • invite_code (#to_s)

    Invite Code

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2510
2511
2512
2513
2514
2515
2516
# File 'lib/lib_discord/client.rb', line 2510

def delete_invite(invite_code, reason: nil)
  json_request(
    :delete,
    discord("/invites/#{invite_code}"),
    headers: auditlog(reason)
  )
end

#delete_lobby(lobby_id, reason: nil) ⇒ Response

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2577
2578
2579
2580
2581
2582
2583
# File 'lib/lib_discord/client.rb', line 2577

def delete_lobby(lobby_id, reason: nil)
  json_request(
    :delete,
    discord("/lobbies/#{lobby_id}"),
    headers: auditlog(reason)
  )
end

#delete_message(channel_id, message_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2866
2867
2868
2869
2870
2871
2872
# File 'lib/lib_discord/client.rb', line 2866

def delete_message(channel_id, message_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/messages/#{message_id}"),
    headers: auditlog(reason)
  )
end

#delete_original_interaction_response(application_id, interaction_token, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • interaction_token (#to_s)

    Interaction Token

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



215
216
217
218
219
220
221
# File 'lib/lib_discord/client.rb', line 215

def delete_original_interaction_response(application_id, interaction_token, reason: nil)
  json_request(
    :delete,
    discord("/webhooks/#{application_id}/#{interaction_token}/messages/@original"),
    headers: auditlog(reason)
  )
end

#delete_own_reaction(channel_id, message_id, emoji, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • emoji (#to_s)

    Emoji

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2762
2763
2764
2765
2766
2767
2768
# File 'lib/lib_discord/client.rb', line 2762

def delete_own_reaction(channel_id, message_id, emoji, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}/@me"),
    headers: auditlog(reason)
  )
end

#delete_stage_instance(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3125
3126
3127
3128
3129
3130
3131
# File 'lib/lib_discord/client.rb', line 3125

def delete_stage_instance(channel_id, reason: nil)
  json_request(
    :delete,
    discord("/stage-instances/#{channel_id}"),
    headers: auditlog(reason)
  )
end

#delete_test_entitlement(application_id, entitlement_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • entitlement_id (#to_s)

    Entitlement ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1473
1474
1475
1476
1477
1478
1479
# File 'lib/lib_discord/client.rb', line 1473

def delete_test_entitlement(application_id, entitlement_id, reason: nil)
  json_request(
    :delete,
    discord("/applications/#{application_id}/entitlements/#{entitlement_id}"),
    headers: auditlog(reason)
  )
end

#delete_user_reaction(channel_id, message_id, emoji, user_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • emoji (#to_s)

    Emoji

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2780
2781
2782
2783
2784
2785
2786
# File 'lib/lib_discord/client.rb', line 2780

def delete_user_reaction(channel_id, message_id, emoji, user_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}/#{user_id}"),
    headers: auditlog(reason)
  )
end

#delete_webhook(webhook_id, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3680
3681
3682
3683
3684
3685
3686
# File 'lib/lib_discord/client.rb', line 3680

def delete_webhook(webhook_id, reason: nil)
  json_request(
    :delete,
    discord("/webhooks/#{webhook_id}"),
    headers: auditlog(reason)
  )
end

#delete_webhook_message(webhook_id, webhook_token, message_id, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3809
3810
3811
3812
3813
3814
3815
# File 'lib/lib_discord/client.rb', line 3809

def delete_webhook_message(webhook_id, webhook_token, message_id, reason: nil)
  json_request(
    :delete,
    discord("/webhooks/#{webhook_id}/#{webhook_token}/messages/#{message_id}"),
    headers: auditlog(reason)
  )
end

#delete_webhook_with_token(webhook_id, webhook_token, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3696
3697
3698
3699
3700
3701
3702
# File 'lib/lib_discord/client.rb', line 3696

def delete_webhook_with_token(webhook_id, webhook_token, reason: nil)
  json_request(
    :delete,
    discord("/webhooks/#{webhook_id}/#{webhook_token}"),
    headers: auditlog(reason)
  )
end

#edit_application_command_permissions(application_id, guild_id, command_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • command_id (#to_s)

    Command ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



549
550
551
552
553
554
555
556
# File 'lib/lib_discord/client.rb', line 549

def edit_application_command_permissions(application_id, guild_id, command_id, body, reason: nil)
  json_request(
    :put,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_channel_permissions(channel_id, overwrite_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • overwrite_id (#to_s)

    Overwrite ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



860
861
862
863
864
865
866
867
# File 'lib/lib_discord/client.rb', line 860

def edit_channel_permissions(channel_id, overwrite_id, body, reason: nil)
  json_request(
    :put,
    discord("/channels/#{channel_id}/permissions/#{overwrite_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_current_application(body, reason: nil) ⇒ Response

Parameters:

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



666
667
668
669
670
671
672
673
# File 'lib/lib_discord/client.rb', line 666

def edit_current_application(body, reason: nil)
  json_request(
    :patch,
    discord("/applications/@me"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_followup_message(application_id, interaction_token, message_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • interaction_token (#to_s)

    Interaction Token

  • message_id (#to_s)

    Message ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



268
269
270
271
272
273
274
275
# File 'lib/lib_discord/client.rb', line 268

def edit_followup_message(application_id, interaction_token, message_id, body, reason: nil)
  json_request(
    :patch,
    discord("/webhooks/#{application_id}/#{interaction_token}/messages/#{message_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_global_application_command(application_id, command_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • command_id (#to_s)

    Command ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



357
358
359
360
361
362
363
364
# File 'lib/lib_discord/client.rb', line 357

def edit_global_application_command(application_id, command_id, body, reason: nil)
  json_request(
    :patch,
    discord("/applications/#{application_id}/commands/#{command_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_guild_application_command(application_id, guild_id, command_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • command_id (#to_s)

    Command ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



462
463
464
465
466
467
468
469
# File 'lib/lib_discord/client.rb', line 462

def edit_guild_application_command(application_id, guild_id, command_id, body, reason: nil)
  json_request(
    :patch,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_message(channel_id, message_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2849
2850
2851
2852
2853
2854
2855
2856
# File 'lib/lib_discord/client.rb', line 2849

def edit_message(channel_id, message_id, body, reason: nil)
  json_request(
    :patch,
    discord("/channels/#{channel_id}/messages/#{message_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_original_interaction_response(application_id, interaction_token, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • interaction_token (#to_s)

    Interaction Token

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



198
199
200
201
202
203
204
205
# File 'lib/lib_discord/client.rb', line 198

def edit_original_interaction_response(application_id, interaction_token, body, reason: nil)
  json_request(
    :patch,
    discord("/webhooks/#{application_id}/#{interaction_token}/messages/@original"),
    body:,
    headers: auditlog(reason)
  )
end

#edit_webhook_message(webhook_id, webhook_token, message_id, body, query = {}, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • message_id (#to_s)

    Message ID

  • body (#to_json)

    Request body

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3790
3791
3792
3793
3794
3795
3796
3797
3798
# File 'lib/lib_discord/client.rb', line 3790

def edit_webhook_message(webhook_id, webhook_token, message_id, body, query = {}, reason: nil)
  json_request(
    :patch,
    discord("/webhooks/#{webhook_id}/#{webhook_token}/messages/#{message_id}"),
    body:,
    query:,
    headers: auditlog(reason)
  )
end

#end_poll(channel_id, message_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2922
2923
2924
2925
2926
2927
2928
# File 'lib/lib_discord/client.rb', line 2922

def end_poll(channel_id, message_id, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/polls/#{message_id}/expire"),
    headers: auditlog(reason)
  )
end

#execute_github_compatible_webhook(webhook_id, webhook_token, query = {}, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3751
3752
3753
3754
3755
3756
3757
3758
# File 'lib/lib_discord/client.rb', line 3751

def execute_github_compatible_webhook(webhook_id, webhook_token, query = {}, reason: nil)
  json_request(
    :post,
    discord("/webhooks/#{webhook_id}/#{webhook_token}/github"),
    query:,
    headers: auditlog(reason)
  )
end

#execute_slack_compatible_webhook(webhook_id, webhook_token, query = {}, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3733
3734
3735
3736
3737
3738
3739
3740
# File 'lib/lib_discord/client.rb', line 3733

def execute_slack_compatible_webhook(webhook_id, webhook_token, query = {}, reason: nil)
  json_request(
    :post,
    discord("/webhooks/#{webhook_id}/#{webhook_token}/slack"),
    query:,
    headers: auditlog(reason)
  )
end

#execute_webhook(webhook_id, webhook_token, body, query = {}, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • body (#to_json)

    Request body

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3714
3715
3716
3717
3718
3719
3720
3721
3722
# File 'lib/lib_discord/client.rb', line 3714

def execute_webhook(webhook_id, webhook_token, body, query = {}, reason: nil)
  json_request(
    :post,
    discord("/webhooks/#{webhook_id}/#{webhook_token}"),
    body:,
    query:,
    headers: auditlog(reason)
  )
end

#follow_announcement_channel(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



925
926
927
928
929
930
931
932
# File 'lib/lib_discord/client.rb', line 925

def follow_announcement_channel(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/followers"),
    body:,
    headers: auditlog(reason)
  )
end

#get_answer_voters(channel_id, message_id, answer_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • answer_id (#to_s)

    Answer ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2905
2906
2907
2908
2909
2910
2911
2912
# File 'lib/lib_discord/client.rb', line 2905

def get_answer_voters(channel_id, message_id, answer_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/polls/#{message_id}/answers/#{answer_id}"),
    query:,
    headers: auditlog(reason)
  )
end

#get_application_activity_instance(application_id, instance_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • instance_id (#to_s)

    Activity Instance ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



683
684
685
686
687
688
689
# File 'lib/lib_discord/client.rb', line 683

def get_application_activity_instance(application_id, instance_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/activity-instances/#{instance_id}"),
    headers: auditlog(reason)
  )
end

#get_application_command_permissions(application_id, guild_id, command_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • command_id (#to_s)

    Command ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



531
532
533
534
535
536
537
# File 'lib/lib_discord/client.rb', line 531

def get_application_command_permissions(application_id, guild_id, command_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}/permissions"),
    headers: auditlog(reason)
  )
end

#get_application_emoji(application_id, emoji_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • emoji_id (#to_s)

    Emoji ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1339
1340
1341
1342
1343
1344
1345
# File 'lib/lib_discord/client.rb', line 1339

def get_application_emoji(application_id, emoji_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/emojis/#{emoji_id}"),
    headers: auditlog(reason)
  )
end

#get_application_role_connection_metadata_records(application_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



619
620
621
622
623
624
625
# File 'lib/lib_discord/client.rb', line 619

def (application_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/role-connections/metadata"),
    headers: auditlog(reason)
  )
end

#get_authorize_url(query = {}) ⇒ URI

Get the URL for starting the OAuth2 Authorization flow.

Parameters:

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

Returns:

  • (URI)

    OAuth2 Authorization URL, with query parameters added.

See Also:



3866
3867
3868
3869
3870
# File 'lib/lib_discord/client.rb', line 3866

def get_authorize_url(query = {})
  uri = URI(discord("/oauth2/authorize", prefix: ""))
  uri.query = URI.encode_www_form(query)
  uri
end

#get_auto_moderation_rule(guild_id, auto_moderation_rule_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • auto_moderation_rule_id (#to_s)

    Auto Moderation Rule ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



739
740
741
742
743
744
745
# File 'lib/lib_discord/client.rb', line 739

def get_auto_moderation_rule(guild_id, auto_moderation_rule_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/auto-moderation/rules/#{auto_moderation_rule_id}"),
    headers: auditlog(reason)
  )
end

#get_channel(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



809
810
811
812
813
814
815
# File 'lib/lib_discord/client.rb', line 809

def get_channel(channel_id, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}"),
    headers: auditlog(reason)
  )
end

#get_channel_invites(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



876
877
878
879
880
881
882
# File 'lib/lib_discord/client.rb', line 876

def get_channel_invites(channel_id, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/invites"),
    headers: auditlog(reason)
  )
end

#get_channel_message(channel_id, message_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2695
2696
2697
2698
2699
2700
2701
# File 'lib/lib_discord/client.rb', line 2695

def get_channel_message(channel_id, message_id, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/messages/#{message_id}"),
    headers: auditlog(reason)
  )
end

#get_channel_messages(channel_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2678
2679
2680
2681
2682
2683
2684
2685
# File 'lib/lib_discord/client.rb', line 2678

def get_channel_messages(channel_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/messages"),
    query:,
    headers: auditlog(reason)
  )
end

#get_channel_webhooks(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3584
3585
3586
3587
3588
3589
3590
# File 'lib/lib_discord/client.rb', line 3584

def get_channel_webhooks(channel_id, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/webhooks"),
    headers: auditlog(reason)
  )
end

#get_current_application(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



655
656
657
# File 'lib/lib_discord/client.rb', line 655

def get_current_application(reason: nil)
  json_request(:get, discord("/applications/@me"), headers: auditlog(reason))
end

#get_current_user(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3310
3311
3312
3313
3314
3315
# File 'lib/lib_discord/client.rb', line 3310

def get_current_user(reason: nil)
  json_request(
    :get, discord("/users/@me"),
    headers: auditlog(reason)
  )
end

#get_current_user_application_role_connection(application_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3447
3448
3449
3450
3451
3452
3453
# File 'lib/lib_discord/client.rb', line 3447

def get_current_user_application_role_connection(application_id, reason: nil)
  json_request(
    :get,
    discord("/users/@me/applications/#{application_id}/role-connections"),
    headers: auditlog(reason)
  )
end

#get_current_user_connections(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3432
3433
3434
3435
3436
3437
3438
# File 'lib/lib_discord/client.rb', line 3432

def get_current_user_connections(reason: nil)
  json_request(
    :get,
    discord("/users/@me/connections"),
    headers: auditlog(reason)
  )
end

#get_current_user_guild_member(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3371
3372
3373
3374
3375
3376
3377
# File 'lib/lib_discord/client.rb', line 3371

def get_current_user_guild_member(guild_id, reason: nil)
  json_request(
    :get,
    discord("/users/@me/guilds/#{guild_id}/member"),
    headers: auditlog(reason)
  )
end

#get_current_user_guilds(query = {}, reason: nil) ⇒ Response

Parameters:

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3355
3356
3357
3358
3359
3360
3361
3362
# File 'lib/lib_discord/client.rb', line 3355

def get_current_user_guilds(query = {}, reason: nil)
  json_request(
    :get,
    discord("/users/@me/guilds"),
    query:,
    headers: auditlog(reason)
  )
end

#get_current_user_voice_state(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3497
3498
3499
3500
3501
3502
3503
# File 'lib/lib_discord/client.rb', line 3497

def get_current_user_voice_state(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/voice-states/@me"),
    headers: auditlog(reason)
  )
end

#get_entitlement(application_id, entitlement_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • entitlement_id (#to_s)

    Entitlement ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1425
1426
1427
1428
1429
1430
1431
# File 'lib/lib_discord/client.rb', line 1425

def get_entitlement(application_id, entitlement_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/entitlements/#{entitlement_id}"),
    headers: auditlog(reason)
  )
end

#get_followup_message(application_id, interaction_token, message_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • interaction_token (#to_s)

    Interaction Token

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



250
251
252
253
254
255
256
# File 'lib/lib_discord/client.rb', line 250

def get_followup_message(application_id, interaction_token, message_id, reason: nil)
  json_request(
    :get,
    discord("/webhooks/#{application_id}/#{interaction_token}/messages/#{message_id}"),
    headers: auditlog(reason)
  )
end

#get_gateway(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



593
594
595
# File 'lib/lib_discord/client.rb', line 593

def get_gateway(reason: nil)
  json_request(:get, discord("/gateway"), headers: auditlog(reason))
end

#get_gateway_bot(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



603
604
605
# File 'lib/lib_discord/client.rb', line 603

def get_gateway_bot(reason: nil)
  json_request(:get, discord("/gateway/bot"), headers: auditlog(reason))
end

#get_global_application_command(application_id, command_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • command_id (#to_s)

    Command ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



340
341
342
343
344
345
346
# File 'lib/lib_discord/client.rb', line 340

def get_global_application_command(application_id, command_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/commands/#{command_id}"),
    headers: auditlog(reason)
  )
end

#get_global_application_commands(application_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



306
307
308
309
310
311
312
313
# File 'lib/lib_discord/client.rb', line 306

def get_global_application_commands(application_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/commands"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1735
1736
1737
1738
1739
1740
1741
1742
# File 'lib/lib_discord/client.rb', line 1735

def get_guild(guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}"),
    query:,
    headers: auditlog(reason)
  )
end

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

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • command_id (#to_s)

    Command ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



444
445
446
447
448
449
450
# File 'lib/lib_discord/client.rb', line 444

def get_guild_application_command(application_id, guild_id, command_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands/#{command_id}"),
    headers: auditlog(reason)
  )
end

#get_guild_application_command_permissions(application_id, guild_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



514
515
516
517
518
519
520
# File 'lib/lib_discord/client.rb', line 514

def get_guild_application_command_permissions(application_id, guild_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands/permissions"),
    headers: auditlog(reason)
  )
end

#get_guild_application_commands(application_id, guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



408
409
410
411
412
413
414
415
# File 'lib/lib_discord/client.rb', line 408

def get_guild_application_commands(application_id, guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/guilds/#{guild_id}/commands"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild_audit_log(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



703
704
705
706
707
708
709
710
# File 'lib/lib_discord/client.rb', line 703

def get_guild_audit_log(guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/audit-logs"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild_ban(guild_id, user_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2052
2053
2054
2055
2056
2057
2058
# File 'lib/lib_discord/client.rb', line 2052

def get_guild_ban(guild_id, user_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/bans/#{user_id}"),
    headers: auditlog(reason)
  )
end

#get_guild_bans(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2035
2036
2037
2038
2039
2040
2041
2042
# File 'lib/lib_discord/client.rb', line 2035

def get_guild_bans(guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/bans"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild_channels(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1798
1799
1800
1801
1802
1803
1804
# File 'lib/lib_discord/client.rb', line 1798

def get_guild_channels(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/channels"),
    headers: auditlog(reason)
  )
end

#get_guild_emoji(guild_id, emoji_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • emoji_id (#to_s)

    Emoji ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1257
1258
1259
1260
1261
1262
1263
# File 'lib/lib_discord/client.rb', line 1257

def get_guild_emoji(guild_id, emoji_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/emojis/#{emoji_id}"),
    headers: auditlog(reason)
  )
end

#get_guild_integrations(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2298
2299
2300
2301
2302
2303
2304
# File 'lib/lib_discord/client.rb', line 2298

def get_guild_integrations(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/integrations"),
    headers: auditlog(reason)
  )
end

#get_guild_invites(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2283
2284
2285
2286
2287
2288
2289
# File 'lib/lib_discord/client.rb', line 2283

def get_guild_invites(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/invites"),
    headers: auditlog(reason)
  )
end

#get_guild_member(guild_id, user_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1863
1864
1865
1866
1867
1868
1869
# File 'lib/lib_discord/client.rb', line 1863

def get_guild_member(guild_id, user_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/members/#{user_id}"),
    headers: auditlog(reason)
  )
end

#get_guild_onboarding(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2440
2441
2442
2443
2444
2445
2446
# File 'lib/lib_discord/client.rb', line 2440

def get_guild_onboarding(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/onboarding"),
    headers: auditlog(reason)
  )
end

#get_guild_preview(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1751
1752
1753
1754
1755
1756
1757
# File 'lib/lib_discord/client.rb', line 1751

def get_guild_preview(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/preview"),
    headers: auditlog(reason)
  )
end

#get_guild_prune_count(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2235
2236
2237
2238
2239
2240
2241
2242
# File 'lib/lib_discord/client.rb', line 2235

def get_guild_prune_count(guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/prune"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild_role(guild_id, role_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • role_id (#to_s)

    Role ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2134
2135
2136
2137
2138
2139
2140
# File 'lib/lib_discord/client.rb', line 2134

def get_guild_role(guild_id, role_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/roles/#{role_id}"),
    headers: auditlog(reason)
  )
end

#get_guild_roles(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2118
2119
2120
2121
2122
2123
2124
# File 'lib/lib_discord/client.rb', line 2118

def get_guild_roles(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/roles"),
    headers: auditlog(reason)
  )
end

#get_guild_scheduled_event(guild_id, guild_scheduled_event_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • guild_scheduled_event_id (#to_s)

    Guild Scheduled Event ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1528
1529
1530
1531
1532
1533
1534
1535
# File 'lib/lib_discord/client.rb', line 1528

def get_guild_scheduled_event(guild_id, guild_scheduled_event_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild_scheduled_event_users(guild_id, guild_scheduled_event_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • guild_scheduled_event_id (#to_s)

    Guild Scheduled Event ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1580
1581
1582
1583
1584
1585
1586
1587
# File 'lib/lib_discord/client.rb', line 1580

def get_guild_scheduled_event_users(guild_id, guild_scheduled_event_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}/users"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild_soundboard_sound(guild_id, sound_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • sound_id (#to_s)

    Sound ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3007
3008
3009
3010
3011
3012
3013
# File 'lib/lib_discord/client.rb', line 3007

def get_guild_soundboard_sound(guild_id, sound_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/soundboard-sounds/#{sound_id}"),
    headers: auditlog(reason)
  )
end

#get_guild_sticker(guild_id, sticker_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • sticker_id (#to_s)

    Sticker ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3204
3205
3206
3207
3208
3209
3210
# File 'lib/lib_discord/client.rb', line 3204

def get_guild_sticker(guild_id, sticker_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/stickers/#{sticker_id}"),
    headers: auditlog(reason)
  )
end

#get_guild_template(template_code, reason: nil) ⇒ Response

Parameters:

  • template_code (#to_s)

    Template Code

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1600
1601
1602
1603
1604
1605
1606
# File 'lib/lib_discord/client.rb', line 1600

def get_guild_template(template_code, reason: nil)
  json_request(
    :get,
    discord("/guilds/templates/#{template_code}"),
    headers: auditlog(reason)
  )
end

#get_guild_templates(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1632
1633
1634
1635
1636
1637
1638
# File 'lib/lib_discord/client.rb', line 1632

def get_guild_templates(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/templates"),
    headers: auditlog(reason)
  )
end

#get_guild_vanity_url(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2376
2377
2378
2379
2380
2381
2382
# File 'lib/lib_discord/client.rb', line 2376

def get_guild_vanity_url(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/vanity-url"),
    headers: auditlog(reason)
  )
end

#get_guild_voice_regions(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2268
2269
2270
2271
2272
2273
2274
# File 'lib/lib_discord/client.rb', line 2268

def get_guild_voice_regions(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/regions"),
    headers: auditlog(reason)
  )
end

#get_guild_webhooks(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3599
3600
3601
3602
3603
3604
3605
# File 'lib/lib_discord/client.rb', line 3599

def get_guild_webhooks(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/webhooks"),
    headers: auditlog(reason)
  )
end

#get_guild_welcome_screen(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2408
2409
2410
2411
2412
2413
2414
# File 'lib/lib_discord/client.rb', line 2408

def get_guild_welcome_screen(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/welcome-screen"),
    headers: auditlog(reason)
  )
end

#get_guild_widget(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2361
2362
2363
2364
2365
2366
2367
# File 'lib/lib_discord/client.rb', line 2361

def get_guild_widget(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/widget.json"),
    headers: auditlog(reason)
  )
end

#get_guild_widget_image(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2392
2393
2394
2395
2396
2397
2398
2399
# File 'lib/lib_discord/client.rb', line 2392

def get_guild_widget_image(guild_id, query = {}, reason: nil)
  net_request(
    :get,
    discord("/guilds/#{guild_id}/widget.png"),
    query:,
    headers: auditlog(reason)
  )
end

#get_guild_widget_settings(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2329
2330
2331
2332
2333
2334
2335
# File 'lib/lib_discord/client.rb', line 2329

def get_guild_widget_settings(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/widget"),
    headers: auditlog(reason)
  )
end

#get_install_url(query = {}) ⇒ URI

Get the URL for installing an application.

Parameters:

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

Returns:

  • (URI)

    Application installation URL, with query parameters added.

See Also:



3880
# File 'lib/lib_discord/client.rb', line 3880

def get_install_url(query = {}) = get_authorize_url(query)

#get_invite(invite_code, query = {}, reason: nil) ⇒ Response

Parameters:

  • invite_code (#to_s)

    Invite Code

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2494
2495
2496
2497
2498
2499
2500
2501
# File 'lib/lib_discord/client.rb', line 2494

def get_invite(invite_code, query = {}, reason: nil)
  json_request(
    :get,
    discord("/invites/#{invite_code}"),
    query:,
    headers: auditlog(reason)
  )
end

#get_lobby(lobby_id, reason: nil) ⇒ Response

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2545
2546
2547
2548
2549
2550
2551
# File 'lib/lib_discord/client.rb', line 2545

def get_lobby(lobby_id, reason: nil)
  json_request(
    :get,
    discord("/lobbies/#{lobby_id}"),
    headers: auditlog(reason)
  )
end

#get_original_interaction_response(application_id, interaction_token, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • interaction_token (#to_s)

    Interaction Token

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



181
182
183
184
185
186
187
# File 'lib/lib_discord/client.rb', line 181

def get_original_interaction_response(application_id, interaction_token, reason: nil)
  json_request(
    :get,
    discord("/webhooks/#{application_id}/#{interaction_token}/messages/@original"),
    headers: auditlog(reason)
  )
end

#get_pinned_messages(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



956
957
958
959
960
961
962
# File 'lib/lib_discord/client.rb', line 956

def get_pinned_messages(channel_id, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/pins"),
    headers: auditlog(reason)
  )
end

#get_reactions(channel_id, message_id, emoji, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • emoji (#to_s)

    Emoji

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2798
2799
2800
2801
2802
2803
2804
2805
# File 'lib/lib_discord/client.rb', line 2798

def get_reactions(channel_id, message_id, emoji, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}"),
    query:,
    headers: auditlog(reason)
  )
end

#get_sku_subscription(sku_id, subscription_id, reason: nil) ⇒ Response

Parameters:

  • sku_id (#to_s)

    SKU ID

  • subscription_id (#to_s)

    Subscription ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3292
3293
3294
3295
3296
3297
3298
# File 'lib/lib_discord/client.rb', line 3292

def get_sku_subscription(sku_id, subscription_id, reason: nil)
  json_request(
    :get,
    discord("/skus/#{sku_id}/subscriptions/#{subscription_id}"),
    headers: auditlog(reason)
  )
end

#get_stage_instance(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3093
3094
3095
3096
3097
3098
3099
# File 'lib/lib_discord/client.rb', line 3093

def get_stage_instance(channel_id, reason: nil)
  json_request(
    :get,
    discord("/stage-instances/#{channel_id}"),
    headers: auditlog(reason)
  )
end

#get_sticker(sticker_id, reason: nil) ⇒ Response

Parameters:

  • sticker_id (#to_s)

    Sticker ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3144
3145
3146
3147
3148
3149
3150
# File 'lib/lib_discord/client.rb', line 3144

def get_sticker(sticker_id, reason: nil)
  json_request(
    :get,
    discord("/stickers/#{sticker_id}"),
    headers: auditlog(reason)
  )
end

#get_sticker_pack(pack_id, reason: nil) ⇒ Response

Parameters:

  • sticker_id (#to_s)

    Sticker Pack ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3173
3174
3175
3176
3177
3178
3179
# File 'lib/lib_discord/client.rb', line 3173

def get_sticker_pack(pack_id, reason: nil)
  json_request(
    :get,
    discord("/sticker-packs/#{pack_id}"),
    headers: auditlog(reason)
  )
end

#get_thread_member(channel_id, user_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • user_id (#to_s)

    User ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/lib_discord/client.rb', line 1153

def get_thread_member(channel_id, user_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/thread-members/#{user_id}"),
    query:,
    headers: auditlog(reason)
  )
end

#get_user(user_id, reason: nil) ⇒ Response

Parameters:

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3324
3325
3326
3327
3328
3329
3330
# File 'lib/lib_discord/client.rb', line 3324

def get_user(user_id, reason: nil)
  json_request(
    :get,
    discord("/users/#{user_id}"),
    headers: auditlog(reason)
  )
end

#get_user_voice_state(guild_id, user_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3513
3514
3515
3516
3517
3518
3519
# File 'lib/lib_discord/client.rb', line 3513

def get_user_voice_state(guild_id, user_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/voice-states/#{user_id}"),
    headers: auditlog(reason)
  )
end

#get_webhook(webhook_id, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3614
3615
3616
3617
3618
3619
3620
# File 'lib/lib_discord/client.rb', line 3614

def get_webhook(webhook_id, reason: nil)
  json_request(
    :get,
    discord("/webhooks/#{webhook_id}"),
    headers: auditlog(reason)
  )
end

#get_webhook_message(webhook_id, webhook_token, message_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • message_id (#to_s)

    Message ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3770
3771
3772
3773
3774
3775
3776
3777
# File 'lib/lib_discord/client.rb', line 3770

def get_webhook_message(webhook_id, webhook_token, message_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/webhooks/#{webhook_id}/#{webhook_token}/messages/#{message_id}"),
    query:,
    headers: auditlog(reason)
  )
end

#get_webhook_with_token(webhook_id, webhook_token, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3630
3631
3632
3633
3634
3635
3636
# File 'lib/lib_discord/client.rb', line 3630

def get_webhook_with_token(webhook_id, webhook_token, reason: nil)
  json_request(
    :get,
    discord("/webhooks/#{webhook_id}/#{webhook_token}"),
    headers: auditlog(reason)
  )
end

#group_dm_add_recipient(channel_id, user_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • user_id (#to_s)

    User ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1005
1006
1007
1008
1009
1010
1011
1012
# File 'lib/lib_discord/client.rb', line 1005

def group_dm_add_recipient(channel_id, user_id, body, reason: nil)
  json_request(
    :put,
    discord("/channels/#{channel_id}/recipients/#{user_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#group_dm_remove_recipient(channel_id, user_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1022
1023
1024
1025
1026
1027
1028
# File 'lib/lib_discord/client.rb', line 1022

def group_dm_remove_recipient(channel_id, user_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/recipients/#{user_id}"),
    headers: auditlog(reason)
  )
end

#join_thread(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1089
1090
1091
1092
1093
1094
1095
# File 'lib/lib_discord/client.rb', line 1089

def join_thread(channel_id, reason: nil)
  json_request(
    :put,
    discord("/channels/#{channel_id}/thread-members/@me"),
    headers: auditlog(reason)
  )
end

#leave_guild(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3386
3387
3388
3389
3390
3391
3392
# File 'lib/lib_discord/client.rb', line 3386

def leave_guild(guild_id, reason: nil)
  json_request(
    :delete,
    discord("/users/@me/guilds/#{guild_id}"),
    headers: auditlog(reason)
  )
end

#leave_lobby(lobby_id, reason: nil) ⇒ Response

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2626
2627
2628
2629
2630
2631
2632
# File 'lib/lib_discord/client.rb', line 2626

def leave_lobby(lobby_id, reason: nil)
  json_request(
    :delete,
    discord("/lobbies/#{lobby_id}/members/@me"),
    headers: auditlog(reason)
  )
end

#leave_thread(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1120
1121
1122
1123
1124
1125
1126
# File 'lib/lib_discord/client.rb', line 1120

def leave_thread(channel_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/thread-members/@me"),
    headers: auditlog(reason)
  )
end

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2642
2643
2644
2645
2646
2647
2648
2649
# File 'lib/lib_discord/client.rb', line 2642

def link_channel_to_lobby(lobby_id, body, reason: nil)
  json_request(
    :patch,
    discord("/lobbies/#{lobby_id}/channel-linking"),
    body:,
    headers: auditlog(reason)
  )
end

#list_active_guild_threads(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1847
1848
1849
1850
1851
1852
1853
# File 'lib/lib_discord/client.rb', line 1847

def list_active_guild_threads(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/threads/active"),
    headers: auditlog(reason)
  )
end

#list_application_emojis(application_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1323
1324
1325
1326
1327
1328
1329
# File 'lib/lib_discord/client.rb', line 1323

def list_application_emojis(application_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/emojis"),
    headers: auditlog(reason)
  )
end

#list_auto_moderation_rules_for_guild(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



723
724
725
726
727
728
729
# File 'lib/lib_discord/client.rb', line 723

def list_auto_moderation_rules_for_guild(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/auto-moderation/rules"),
    headers: auditlog(reason)
  )
end

#list_default_soundboard_sounds(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2976
2977
2978
2979
2980
2981
2982
# File 'lib/lib_discord/client.rb', line 2976

def list_default_soundboard_sounds(reason: nil)
  json_request(
    :get,
    discord("/soundboard-default-sounds"),
    headers: auditlog(reason)
  )
end

#list_entitlements(application_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1409
1410
1411
1412
1413
1414
1415
# File 'lib/lib_discord/client.rb', line 1409

def list_entitlements(application_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/entitlements"),
    headers: auditlog(reason)
  )
end

#list_guild_emojis(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1241
1242
1243
1244
1245
1246
1247
# File 'lib/lib_discord/client.rb', line 1241

def list_guild_emojis(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/emojis"),
    headers: auditlog(reason)
  )
end

#list_guild_members(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1879
1880
1881
1882
1883
1884
1885
1886
# File 'lib/lib_discord/client.rb', line 1879

def list_guild_members(guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/members"),
    query:,
    headers: auditlog(reason)
  )
end

#list_guild_soundboard_sounds(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2991
2992
2993
2994
2995
2996
2997
# File 'lib/lib_discord/client.rb', line 2991

def list_guild_soundboard_sounds(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/soundboard-sounds"),
    headers: auditlog(reason)
  )
end

#list_guild_stickers(guild_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3188
3189
3190
3191
3192
3193
3194
# File 'lib/lib_discord/client.rb', line 3188

def list_guild_stickers(guild_id, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/stickers"),
    headers: auditlog(reason)
  )
end

#list_joined_private_archived_threads(channel_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1221
1222
1223
1224
1225
1226
1227
1228
# File 'lib/lib_discord/client.rb', line 1221

def list_joined_private_archived_threads(channel_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/users/@me/threads/archived/private"),
    query:,
    headers: auditlog(reason)
  )
end

#list_private_archived_threads(channel_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1204
1205
1206
1207
1208
1209
1210
1211
# File 'lib/lib_discord/client.rb', line 1204

def list_private_archived_threads(channel_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/threads/archived/private"),
    query:,
    headers: auditlog(reason)
  )
end

#list_public_archived_threads(channel_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1187
1188
1189
1190
1191
1192
1193
1194
# File 'lib/lib_discord/client.rb', line 1187

def list_public_archived_threads(channel_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/threads/archived/public"),
    query:,
    headers: auditlog(reason)
  )
end

#list_scheduled_events_for_guild(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1493
1494
1495
1496
1497
1498
1499
1500
# File 'lib/lib_discord/client.rb', line 1493

def list_scheduled_events_for_guild(guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/scheduled-events"),
    query:,
    headers: auditlog(reason)
  )
end

#list_sku_subscriptions(sku_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • sku_id (#to_s)

    SKU ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3275
3276
3277
3278
3279
3280
3281
3282
# File 'lib/lib_discord/client.rb', line 3275

def list_sku_subscriptions(sku_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/skus/#{sku_id}/subscriptions"),
    query:,
    headers: auditlog(reason)
  )
end

#list_skus(application_id, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2941
2942
2943
2944
2945
2946
2947
# File 'lib/lib_discord/client.rb', line 2941

def list_skus(application_id, reason: nil)
  json_request(
    :get,
    discord("/applications/#{application_id}/skus"),
    headers: auditlog(reason)
  )
end

#list_sticker_packs(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3158
3159
3160
3161
3162
3163
3164
# File 'lib/lib_discord/client.rb', line 3158

def list_sticker_packs(reason: nil)
  json_request(
    :get,
    discord("/sticker-packs"),
    headers: auditlog(reason)
  )
end

#list_thread_members(channel_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1170
1171
1172
1173
1174
1175
1176
1177
# File 'lib/lib_discord/client.rb', line 1170

def list_thread_members(channel_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/channels/#{channel_id}/thread-members"),
    query:,
    headers: auditlog(reason)
  )
end

#list_voice_regions(reason: nil) ⇒ Response

Parameters:

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3482
3483
3484
3485
3486
3487
3488
# File 'lib/lib_discord/client.rb', line 3482

def list_voice_regions(reason: nil)
  json_request(
    :get,
    discord("/voice/regions"),
    headers: auditlog(reason)
  )
end

#modify_application_emoji(application_id, emoji_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • emoji_id (#to_s)

    Emoji ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1373
1374
1375
1376
1377
1378
1379
1380
# File 'lib/lib_discord/client.rb', line 1373

def modify_application_emoji(application_id, emoji_id, body, reason: nil)
  json_request(
    :patch,
    discord("/applications/#{application_id}/emojis/#{emoji_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_auto_moderation_rule(guild_id, auto_moderation_rule_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • auto_moderation_rule_id (#to_s)

    Auto Moderation Rule ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



773
774
775
776
777
778
779
780
# File 'lib/lib_discord/client.rb', line 773

def modify_auto_moderation_rule(guild_id, auto_moderation_rule_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/auto-moderation/rules/#{auto_moderation_rule_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_channel(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



825
826
827
828
829
830
831
832
# File 'lib/lib_discord/client.rb', line 825

def modify_channel(channel_id, body, reason: nil)
  json_request(
    :patch,
    discord("/channels/#{channel_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_current_member(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1949
1950
1951
1952
1953
1954
1955
1956
# File 'lib/lib_discord/client.rb', line 1949

def modify_current_member(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/members/@me"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_current_user(body, reason: nil) ⇒ Response

Parameters:

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3339
3340
3341
3342
3343
3344
3345
3346
# File 'lib/lib_discord/client.rb', line 3339

def modify_current_user(body, reason: nil)
  json_request(
    :patch,
    discord("/users/@me"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_current_user_nick(guild_id, body, reason: nil) ⇒ Response

Deprecated.

Use #modify_current_member instead.

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1968
1969
1970
1971
1972
1973
1974
1975
# File 'lib/lib_discord/client.rb', line 1968

def modify_current_user_nick(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/members/@me/nick"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_current_user_voice_state(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3529
3530
3531
3532
3533
3534
3535
3536
# File 'lib/lib_discord/client.rb', line 3529

def modify_current_user_voice_state(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/voice-states/@me"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1767
1768
1769
1770
1771
1772
1773
1774
# File 'lib/lib_discord/client.rb', line 1767

def modify_guild(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_channel_positions(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1831
1832
1833
1834
1835
1836
1837
1838
# File 'lib/lib_discord/client.rb', line 1831

def modify_guild_channel_positions(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/channels"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_emoji(guild_id, emoji_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • emoji_id (#to_s)

    Emoji ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1291
1292
1293
1294
1295
1296
1297
1298
# File 'lib/lib_discord/client.rb', line 1291

def modify_guild_emoji(guild_id, emoji_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/emojis/#{emoji_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_incident_actions(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2473
2474
2475
2476
2477
2478
2479
2480
# File 'lib/lib_discord/client.rb', line 2473

def modify_guild_incident_actions(guild_id, body, reason: nil)
  json_request(
    :put,
    discord("/guilds/#{guild_id}/incident-actions"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_member(guild_id, user_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1932
1933
1934
1935
1936
1937
1938
1939
# File 'lib/lib_discord/client.rb', line 1932

def modify_guild_member(guild_id, user_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/members/#{user_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_mfa_level(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2202
2203
2204
2205
2206
2207
2208
2209
# File 'lib/lib_discord/client.rb', line 2202

def modify_guild_mfa_level(guild_id, body, reason: nil)
  json_request(
    :post,
    discord("/guilds/#{guild_id}/mfa"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_onboarding(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2456
2457
2458
2459
2460
2461
2462
2463
# File 'lib/lib_discord/client.rb', line 2456

def modify_guild_onboarding(guild_id, body, reason: nil)
  json_request(
    :put,
    discord("/guilds/#{guild_id}/onboarding"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_role(guild_id, role_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • role_id (#to_s)

    Role ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2185
2186
2187
2188
2189
2190
2191
2192
# File 'lib/lib_discord/client.rb', line 2185

def modify_guild_role(guild_id, role_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/roles/#{role_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_role_positions(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2167
2168
2169
2170
2171
2172
2173
2174
# File 'lib/lib_discord/client.rb', line 2167

def modify_guild_role_positions(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/roles"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_scheduled_event(guild_id, guild_scheduled_event_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • guild_scheduled_event_id (#to_s)

    Guild Scheduled Event ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1546
1547
1548
1549
1550
1551
1552
1553
# File 'lib/lib_discord/client.rb', line 1546

def modify_guild_scheduled_event(guild_id, guild_scheduled_event_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/scheduled-events/#{guild_scheduled_event_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_soundboard_sound(guild_id, sound_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • sound_id (#to_s)

    Sound ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3041
3042
3043
3044
3045
3046
3047
3048
# File 'lib/lib_discord/client.rb', line 3041

def modify_guild_soundboard_sound(guild_id, sound_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/soundboard-sounds/#{sound_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_sticker(guild_id, sticker_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • sticker_id (#to_s)

    Sticker ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3238
3239
3240
3241
3242
3243
3244
3245
# File 'lib/lib_discord/client.rb', line 3238

def modify_guild_sticker(guild_id, sticker_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/stickers/#{sticker_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_template(guild_id, template_code, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • template_code (#to_s)

    Template Code

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1682
1683
1684
1685
1686
1687
1688
1689
# File 'lib/lib_discord/client.rb', line 1682

def modify_guild_template(guild_id, template_code, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/templates/#{template_code}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_welcome_screen(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2424
2425
2426
2427
2428
2429
2430
2431
# File 'lib/lib_discord/client.rb', line 2424

def modify_guild_welcome_screen(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/welcome-screen"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_guild_widget(guild_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2345
2346
2347
2348
2349
2350
2351
2352
# File 'lib/lib_discord/client.rb', line 2345

def modify_guild_widget(guild_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/widget"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_lobby(lobby_id, body, reason: nil) ⇒ Response

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2561
2562
2563
2564
2565
2566
2567
2568
# File 'lib/lib_discord/client.rb', line 2561

def modify_lobby(lobby_id, body, reason: nil)
  json_request(
    :patch,
    discord("/lobbies/#{lobby_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_stage_instance(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3109
3110
3111
3112
3113
3114
3115
3116
# File 'lib/lib_discord/client.rb', line 3109

def modify_stage_instance(channel_id, body, reason: nil)
  json_request(
    :patch,
    discord("/stage-instances/#{channel_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_user_voice_state(guild_id, user_id, body, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3547
3548
3549
3550
3551
3552
3553
3554
# File 'lib/lib_discord/client.rb', line 3547

def modify_user_voice_state(guild_id, user_id, body, reason: nil)
  json_request(
    :patch,
    discord("/guilds/#{guild_id}/voice-states/#{user_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_webhook(webhook_id, body, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3646
3647
3648
3649
3650
3651
3652
3653
# File 'lib/lib_discord/client.rb', line 3646

def modify_webhook(webhook_id, body, reason: nil)
  json_request(
    :patch,
    discord("/webhooks/#{webhook_id}"),
    body:,
    headers: auditlog(reason)
  )
end

#modify_webhook_with_token(webhook_id, webhook_token, body, reason: nil) ⇒ Response

Parameters:

  • webhook_id (#to_s)

    Webhook ID

  • webhook_token (#to_s)

    Webhook Token

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3664
3665
3666
3667
3668
3669
3670
3671
# File 'lib/lib_discord/client.rb', line 3664

def modify_webhook_with_token(webhook_id, webhook_token, body, reason: nil)
  json_request(
    :patch,
    discord("/webhooks/#{webhook_id}/#{webhook_token}"),
    body:,
    headers: auditlog(reason)
  )
end

#oauth2_request_token(user, pass, query) ⇒ Response

Parameters:

  • user (#to_s)

    HTTP basic authorization username

  • pass (#to_s)

    HTTP basic authorization password

  • query (Object)

    HTTP query parameters. query is formatted via URI.encode_www_form().

Returns:



3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
# File 'lib/lib_discord/client.rb', line 3826

def oauth2_request_token(user, pass, query)
  net_request(
    :post,
    discord("/oauth2/token"),
    body: URI.encode_www_form(query),
    headers: {
      "Authorization" => "Basic " + base64_strictencode("#{user}:#{pass}"),
      "Content-Type" => "application/x-www-form-urlencoded"
    }
  )
end

#oauth2_revoke_token(user, pass, query) ⇒ Response

Parameters:

  • user (#to_s)

    HTTP basic authorization username

  • pass (#to_s)

    HTTP basic authorization password

  • query (Object)

    HTTP query parameters. query is formatted via URI.encode_www_form().

Returns:

See Also:



3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
# File 'lib/lib_discord/client.rb', line 3846

def oauth2_revoke_token(user, pass, query)
  net_request(
    :post,
    discord("/oauth2/token/revoke"),
    body: URI.encode_www_form(query),
    headers: {
      "Authorization" => "Basic " + base64_strictencode("#{user}:#{pass}"),
      "Content-Type" => "application/x-www-form-urlencoded"
    }
  )
end

#pin_message(channel_id, message_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



972
973
974
975
976
977
978
# File 'lib/lib_discord/client.rb', line 972

def pin_message(channel_id, message_id, reason: nil)
  json_request(
    :put,
    discord("/channels/#{channel_id}/pins/#{message_id}"),
    headers: auditlog(reason)
  )
end

#remove_guild_ban(guild_id, user_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2086
2087
2088
2089
2090
2091
2092
# File 'lib/lib_discord/client.rb', line 2086

def remove_guild_ban(guild_id, user_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/bans/#{user_id}"),
    headers: auditlog(reason)
  )
end

#remove_guild_member(guild_id, user_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2019
2020
2021
2022
2023
2024
2025
# File 'lib/lib_discord/client.rb', line 2019

def remove_guild_member(guild_id, user_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/members/#{user_id}"),
    headers: auditlog(reason)
  )
end

#remove_guild_member_role(guild_id, user_id, role_id, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • user_id (#to_s)

    User ID

  • role_id (#to_s)

    Role ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2003
2004
2005
2006
2007
2008
2009
# File 'lib/lib_discord/client.rb', line 2003

def remove_guild_member_role(guild_id, user_id, role_id, reason: nil)
  json_request(
    :delete,
    discord("/guilds/#{guild_id}/members/#{user_id}/roles/#{role_id}"),
    headers: auditlog(reason)
  )
end

#remove_member_from_lobby(lobby_id, user_id, reason: nil) ⇒ Response

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2611
2612
2613
2614
2615
2616
2617
# File 'lib/lib_discord/client.rb', line 2611

def remove_member_from_lobby(lobby_id, user_id, reason: nil)
  json_request(
    :delete,
    discord("/lobbies/#{lobby_id}/members/#{user_id}"),
    headers: auditlog(reason)
  )
end

#remove_thread_member(channel_id, user_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • user_id (#to_s)

    User ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1136
1137
1138
1139
1140
1141
1142
# File 'lib/lib_discord/client.rb', line 1136

def remove_thread_member(channel_id, user_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/thread-members/#{user_id}"),
    headers: auditlog(reason)
  )
end

#search_guild_members(guild_id, query = {}, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • query (Object) (defaults to: {})

    HTTP query parameters. query is formatted via URI.encode_www_form().

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1896
1897
1898
1899
1900
1901
1902
1903
# File 'lib/lib_discord/client.rb', line 1896

def search_guild_members(guild_id, query = {}, reason: nil)
  json_request(
    :get,
    discord("/guilds/#{guild_id}/members/search"),
    query:,
    headers: auditlog(reason)
  )
end

#send_soundboard_sound(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2961
2962
2963
2964
2965
2966
2967
2968
# File 'lib/lib_discord/client.rb', line 2961

def send_soundboard_sound(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/send-soundboard-sound"),
    body:,
    headers: auditlog(reason)
  )
end

#start_thread_from_message(channel_id, message_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1039
1040
1041
1042
1043
1044
1045
1046
# File 'lib/lib_discord/client.rb', line 1039

def start_thread_from_message(channel_id, message_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/messages/#{message_id}/threads"),
    body:,
    headers: auditlog(reason)
  )
end

#start_thread_in_forum_or_media_channel(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1073
1074
1075
1076
1077
1078
1079
1080
# File 'lib/lib_discord/client.rb', line 1073

def start_thread_in_forum_or_media_channel(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/threads"),
    body:,
    headers: auditlog(reason)
  )
end

#start_thread_without_message(channel_id, body, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/lib_discord/client.rb', line 1056

def start_thread_without_message(channel_id, body, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/threads"),
    body:,
    headers: auditlog(reason)
  )
end

#sync_guild_template(guild_id, template_code, reason: nil) ⇒ Response

Parameters:

  • guild_id (#to_s)

    Guild ID

  • template_code (#to_s)

    Template Code

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



1665
1666
1667
1668
1669
1670
1671
# File 'lib/lib_discord/client.rb', line 1665

def sync_guild_template(guild_id, template_code, reason: nil)
  json_request(
    :put,
    discord("/guilds/#{guild_id}/templates/#{template_code}"),
    headers: auditlog(reason)
  )
end

#trigger_typing_indicator(channel_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



941
942
943
944
945
946
947
# File 'lib/lib_discord/client.rb', line 941

def trigger_typing_indicator(channel_id, reason: nil)
  json_request(
    :post,
    discord("/channels/#{channel_id}/typing"),
    headers: auditlog(reason)
  )
end

Parameters:

  • lobby_id (#to_s)

    Lobby ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



2658
2659
2660
2661
2662
2663
2664
# File 'lib/lib_discord/client.rb', line 2658

def unlink_channel_from_lobby(lobby_id, reason: nil)
  json_request(
    :patch,
    discord("/lobbies/#{lobby_id}/channel-linking"),
    headers: auditlog(reason)
  )
end

#unpin_message(channel_id, message_id, reason: nil) ⇒ Response

Parameters:

  • channel_id (#to_s)

    Channel ID

  • message_id (#to_s)

    Message ID

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



988
989
990
991
992
993
994
# File 'lib/lib_discord/client.rb', line 988

def unpin_message(channel_id, message_id, reason: nil)
  json_request(
    :delete,
    discord("/channels/#{channel_id}/pins/#{message_id}"),
    headers: auditlog(reason)
  )
end

#update_application_role_connection_metadata_records(application_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



636
637
638
639
640
641
642
643
# File 'lib/lib_discord/client.rb', line 636

def (application_id, body, reason: nil)
  json_request(
    :put,
    discord("/applications/#{application_id}/role-connections/metadata"),
    body:,
    headers: auditlog(reason)
  )
end

#update_current_user_application_role_connection(application_id, body, reason: nil) ⇒ Response

Parameters:

  • application_id (#to_s)

    Application ID

  • body (#to_json)

    Request body

  • reason (#to_s) (defaults to: nil)

    A short message describing the purpose of this request, sent via the X-Audit-Log-Reason header. If the given endpoint supports the Audit Log, Discord will enter the message into the server’s audit log.

Returns:

See Also:



3463
3464
3465
3466
3467
3468
3469
3470
# File 'lib/lib_discord/client.rb', line 3463

def update_current_user_application_role_connection(application_id, body, reason: nil)
  json_request(
    :put,
    discord("/users/@me/applications/#{application_id}/role-connection"),
    body:,
    headers: auditlog(reason)
  )
end