@discordjs/core 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,14 +20,15 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
 
22
22
  // src/index.ts
23
- var src_exports = {};
24
- __export(src_exports, {
23
+ var index_exports = {};
24
+ __export(index_exports, {
25
25
  API: () => API,
26
26
  ApplicationCommandsAPI: () => ApplicationCommandsAPI,
27
27
  ApplicationsAPI: () => ApplicationsAPI,
28
28
  ChannelsAPI: () => ChannelsAPI,
29
29
  Client: () => Client,
30
30
  GatewayAPI: () => GatewayAPI,
31
+ GatewayRateLimitError: () => import_util2.GatewayRateLimitError,
31
32
  GuildsAPI: () => GuildsAPI,
32
33
  InteractionsAPI: () => InteractionsAPI,
33
34
  InvitesAPI: () => InvitesAPI,
@@ -35,6 +36,7 @@ __export(src_exports, {
35
36
  OAuth2API: () => OAuth2API,
36
37
  PollAPI: () => PollAPI,
37
38
  RoleConnectionsAPI: () => RoleConnectionsAPI,
39
+ SoundboardSoundsAPI: () => SoundboardSoundsAPI,
38
40
  StageInstancesAPI: () => StageInstancesAPI,
39
41
  StickersAPI: () => StickersAPI,
40
42
  ThreadsAPI: () => ThreadsAPI,
@@ -44,7 +46,7 @@ __export(src_exports, {
44
46
  version: () => version,
45
47
  withFiles: () => withFiles
46
48
  });
47
- module.exports = __toCommonJS(src_exports);
49
+ module.exports = __toCommonJS(index_exports);
48
50
 
49
51
  // src/api/applicationCommands.ts
50
52
  var import_rest = require("@discordjs/rest");
@@ -792,6 +794,20 @@ var ChannelsAPI = class {
792
794
  signal
793
795
  });
794
796
  }
797
+ /**
798
+ * Sends a soundboard sound in a channel
799
+ *
800
+ * @see {@link https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound}
801
+ * @param channelId - The id of the channel to send the soundboard sound in
802
+ * @param body - The data for sending the soundboard sound
803
+ * @param options - The options for sending the soundboard sound
804
+ */
805
+ async sendSoundboardSound(channelId, body, { signal } = {}) {
806
+ return this.rest.post(import_v103.Routes.sendSoundboardSound(channelId), {
807
+ body,
808
+ signal
809
+ });
810
+ }
795
811
  /**
796
812
  * Adds a recipient to a group DM channel
797
813
  *
@@ -1012,7 +1028,7 @@ var GuildsAPI = class {
1012
1028
  });
1013
1029
  }
1014
1030
  /**
1015
- * Fetches all the members of a guild
1031
+ * Fetches members of a guild.
1016
1032
  *
1017
1033
  * @see {@link https://discord.com/developers/docs/resources/guild#list-guild-members}
1018
1034
  * @param guildId - The id of the guild
@@ -1765,6 +1781,20 @@ var GuildsAPI = class {
1765
1781
  signal
1766
1782
  });
1767
1783
  }
1784
+ /**
1785
+ * Searches for messages.
1786
+ *
1787
+ * @see {@link https://docs.discord.com/developers/resources/message#search-guild-messages}
1788
+ * @param guildId - The id of the guild to search in
1789
+ * @param query - The query to search for
1790
+ * @param options - The options for searching for messages
1791
+ */
1792
+ async searchForMessages(guildId, query, { signal } = {}) {
1793
+ return this.rest.get(import_v106.Routes.guildMessagesSearch(guildId), {
1794
+ query: (0, import_rest3.makeURLSearchParams)(query),
1795
+ signal
1796
+ });
1797
+ }
1768
1798
  /**
1769
1799
  * Edits a guild member
1770
1800
  *
@@ -1883,6 +1913,73 @@ var GuildsAPI = class {
1883
1913
  signal
1884
1914
  });
1885
1915
  }
1916
+ /**
1917
+ * Fetches all the soundboard sounds for a guild
1918
+ *
1919
+ * @see {@link https://discord.com/developers/docs/resources/soundboard#list-guild-soundboard-sounds}
1920
+ * @param guildId - The id of the guild to fetch the soundboard sounds for
1921
+ * @param options - The options for fetching the soundboard sounds
1922
+ */
1923
+ async getSoundboardSounds(guildId, { signal } = {}) {
1924
+ return this.rest.get(import_v106.Routes.guildSoundboardSounds(guildId), {
1925
+ signal
1926
+ });
1927
+ }
1928
+ /**
1929
+ * Fetches a soundboard sound for a guild
1930
+ *
1931
+ * @see {@link https://discord.com/developers/docs/resources/soundboard#get-guild-soundboard-sound}
1932
+ * @param guildId - The id of the guild to fetch the soundboard sound for
1933
+ * @param soundId - The id of the soundboard sound to fetch
1934
+ * @param options - The options for fetching the soundboard sound
1935
+ */
1936
+ async getSoundboardSound(guildId, soundId, { signal } = {}) {
1937
+ return this.rest.get(import_v106.Routes.guildSoundboardSound(guildId, soundId), {
1938
+ signal
1939
+ });
1940
+ }
1941
+ /**
1942
+ * Creates a new soundboard sound for a guild
1943
+ *
1944
+ * @see {@link https://discord.com/developers/docs/resources/soundboard#create-guild-soundboard-sound}
1945
+ * @param guildId - The id of the guild to create the soundboard sound for
1946
+ * @param body - The data for creating the soundboard sound
1947
+ * @param options - The options for creating the soundboard sound
1948
+ */
1949
+ async createSoundboardSound(guildId, body, { reason, signal } = {}) {
1950
+ return this.rest.post(import_v106.Routes.guildSoundboardSounds(guildId), {
1951
+ body,
1952
+ reason,
1953
+ signal
1954
+ });
1955
+ }
1956
+ /**
1957
+ * Edits a soundboard sound for a guild
1958
+ *
1959
+ * @see {@link https://discord.com/developers/docs/resources/soundboard#modify-guild-soundboard-sound}
1960
+ * @param guildId - The id of the guild to edit the soundboard sound for
1961
+ * @param soundId - The id of the soundboard sound to edit
1962
+ * @param body - The data for editing the soundboard sound
1963
+ * @param options - The options for editing the soundboard sound
1964
+ */
1965
+ async editSoundboardSound(guildId, soundId, body, { reason, signal } = {}) {
1966
+ return this.rest.patch(import_v106.Routes.guildSoundboardSound(guildId, soundId), {
1967
+ body,
1968
+ reason,
1969
+ signal
1970
+ });
1971
+ }
1972
+ /**
1973
+ * Deletes a soundboard sound for a guild
1974
+ *
1975
+ * @see {@link https://discord.com/developers/docs/resources/soundboard#delete-guild-soundboard-sound}
1976
+ * @param guildId - The id of the guild to delete the soundboard sound for
1977
+ * @param soundId - The id of the soundboard sound to delete
1978
+ * @param options - The options for deleting the soundboard sound
1979
+ */
1980
+ async deleteSoundboardSound(guildId, soundId, { reason, signal } = {}) {
1981
+ await this.rest.delete(import_v106.Routes.guildSoundboardSound(guildId, soundId), { reason, signal });
1982
+ }
1886
1983
  /**
1887
1984
  * Modifies incident actions for a guild.
1888
1985
  *
@@ -1900,6 +1997,7 @@ var GuildsAPI = class {
1900
1997
  };
1901
1998
 
1902
1999
  // src/api/interactions.ts
2000
+ var import_rest4 = require("@discordjs/rest");
1903
2001
  var import_v107 = require("discord-api-types/v10");
1904
2002
  var InteractionsAPI = class {
1905
2003
  constructor(rest, webhooks) {
@@ -1909,17 +2007,9 @@ var InteractionsAPI = class {
1909
2007
  static {
1910
2008
  __name(this, "InteractionsAPI");
1911
2009
  }
1912
- /**
1913
- * Replies to an interaction
1914
- *
1915
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
1916
- * @param interactionId - The id of the interaction
1917
- * @param interactionToken - The token of the interaction
1918
- * @param body - The callback data for replying
1919
- * @param options - The options for replying
1920
- */
1921
- async reply(interactionId, interactionToken, { files, ...data }, { signal } = {}) {
1922
- await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2010
+ async reply(interactionId, interactionToken, { files, with_response, ...data }, { signal } = {}) {
2011
+ const response = await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2012
+ query: (0, import_rest4.makeURLSearchParams)({ with_response }),
1923
2013
  files,
1924
2014
  auth: false,
1925
2015
  body: {
@@ -1928,18 +2018,11 @@ var InteractionsAPI = class {
1928
2018
  },
1929
2019
  signal
1930
2020
  });
2021
+ return with_response ? response : void 0;
1931
2022
  }
1932
- /**
1933
- * Defers the reply to an interaction
1934
- *
1935
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
1936
- * @param interactionId - The id of the interaction
1937
- * @param interactionToken - The token of the interaction
1938
- * @param data - The data for deferring the reply
1939
- * @param options - The options for deferring
1940
- */
1941
- async defer(interactionId, interactionToken, data, { signal } = {}) {
1942
- await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2023
+ async defer(interactionId, interactionToken, { with_response, ...data } = {}, { signal } = {}) {
2024
+ const response = await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2025
+ query: (0, import_rest4.makeURLSearchParams)({ with_response }),
1943
2026
  auth: false,
1944
2027
  body: {
1945
2028
  type: import_v107.InteractionResponseType.DeferredChannelMessageWithSource,
@@ -1947,23 +2030,18 @@ var InteractionsAPI = class {
1947
2030
  },
1948
2031
  signal
1949
2032
  });
2033
+ return with_response ? response : void 0;
1950
2034
  }
1951
- /**
1952
- * Defers an update from a message component interaction
1953
- *
1954
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
1955
- * @param interactionId - The id of the interaction
1956
- * @param interactionToken - The token of the interaction
1957
- * @param options - The options for deferring
1958
- */
1959
- async deferMessageUpdate(interactionId, interactionToken, { signal } = {}) {
1960
- await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2035
+ async deferMessageUpdate(interactionId, interactionToken, { with_response } = {}, { signal } = {}) {
2036
+ const response = await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2037
+ query: (0, import_rest4.makeURLSearchParams)({ with_response }),
1961
2038
  auth: false,
1962
2039
  body: {
1963
2040
  type: import_v107.InteractionResponseType.DeferredMessageUpdate
1964
2041
  },
1965
2042
  signal
1966
2043
  });
2044
+ return with_response ? response : void 0;
1967
2045
  }
1968
2046
  /**
1969
2047
  * Reply to a deferred interaction
@@ -2023,17 +2101,9 @@ var InteractionsAPI = class {
2023
2101
  async deleteReply(applicationId, interactionToken, messageId, { signal } = {}) {
2024
2102
  await this.webhooks.deleteMessage(applicationId, interactionToken, messageId ?? "@original", {}, { signal });
2025
2103
  }
2026
- /**
2027
- * Updates the message the component interaction was triggered on
2028
- *
2029
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
2030
- * @param interactionId - The id of the interaction
2031
- * @param interactionToken - The token of the interaction
2032
- * @param callbackData - The callback data for updating the interaction
2033
- * @param options - The options for updating the interaction
2034
- */
2035
- async updateMessage(interactionId, interactionToken, { files, ...data }, { signal } = {}) {
2036
- await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2104
+ async updateMessage(interactionId, interactionToken, { files, with_response, ...data }, { signal } = {}) {
2105
+ const response = await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2106
+ query: (0, import_rest4.makeURLSearchParams)({ with_response }),
2037
2107
  files,
2038
2108
  auth: false,
2039
2109
  body: {
@@ -2042,47 +2112,34 @@ var InteractionsAPI = class {
2042
2112
  },
2043
2113
  signal
2044
2114
  });
2115
+ return with_response ? response : void 0;
2045
2116
  }
2046
- /**
2047
- * Sends an autocomplete response to an interaction
2048
- *
2049
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
2050
- * @param interactionId - The id of the interaction
2051
- * @param interactionToken - The token of the interaction
2052
- * @param callbackData - The callback data for the autocomplete response
2053
- * @param options - The options for sending the autocomplete response
2054
- */
2055
- async createAutocompleteResponse(interactionId, interactionToken, callbackData, { signal } = {}) {
2056
- await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2117
+ async createAutocompleteResponse(interactionId, interactionToken, { with_response, ...data }, { signal } = {}) {
2118
+ const response = await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2119
+ query: (0, import_rest4.makeURLSearchParams)({ with_response }),
2057
2120
  auth: false,
2058
2121
  body: {
2059
2122
  type: import_v107.InteractionResponseType.ApplicationCommandAutocompleteResult,
2060
- data: callbackData
2123
+ data
2061
2124
  },
2062
2125
  signal
2063
2126
  });
2127
+ return with_response ? response : void 0;
2064
2128
  }
2065
- /**
2066
- * Sends a modal response to an interaction
2067
- *
2068
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
2069
- * @param interactionId - The id of the interaction
2070
- * @param interactionToken - The token of the interaction
2071
- * @param callbackData - The modal callback data to send
2072
- * @param options - The options for sending the modal
2073
- */
2074
- async createModal(interactionId, interactionToken, callbackData, { signal } = {}) {
2075
- await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2129
+ async createModal(interactionId, interactionToken, { with_response, ...data }, { signal } = {}) {
2130
+ const response = await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2131
+ query: (0, import_rest4.makeURLSearchParams)({ with_response }),
2076
2132
  auth: false,
2077
2133
  body: {
2078
2134
  type: import_v107.InteractionResponseType.Modal,
2079
- data: callbackData
2135
+ data
2080
2136
  },
2081
2137
  signal
2082
2138
  });
2139
+ return with_response ? response : void 0;
2083
2140
  }
2084
2141
  /**
2085
- * Sends a premium required response to an interaction
2142
+ * Launches an activity and returns an interaction callback object
2086
2143
  *
2087
2144
  * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
2088
2145
  * @param interactionId - The id of the interaction
@@ -2099,10 +2156,21 @@ var InteractionsAPI = class {
2099
2156
  signal
2100
2157
  });
2101
2158
  }
2159
+ async launchActivity(interactionId, interactionToken, { with_response } = {}, { signal } = {}) {
2160
+ const response = await this.rest.post(import_v107.Routes.interactionCallback(interactionId, interactionToken), {
2161
+ query: (0, import_rest4.makeURLSearchParams)({ with_response }),
2162
+ auth: false,
2163
+ body: {
2164
+ type: import_v107.InteractionResponseType.LaunchActivity
2165
+ },
2166
+ signal
2167
+ });
2168
+ return with_response ? response : void 0;
2169
+ }
2102
2170
  };
2103
2171
 
2104
2172
  // src/api/invite.ts
2105
- var import_rest4 = require("@discordjs/rest");
2173
+ var import_rest5 = require("@discordjs/rest");
2106
2174
  var import_v108 = require("discord-api-types/v10");
2107
2175
  var InvitesAPI = class {
2108
2176
  constructor(rest) {
@@ -2121,7 +2189,7 @@ var InvitesAPI = class {
2121
2189
  */
2122
2190
  async get(code, query = {}, { signal } = {}) {
2123
2191
  return this.rest.get(import_v108.Routes.invite(code), {
2124
- query: (0, import_rest4.makeURLSearchParams)(query),
2192
+ query: (0, import_rest5.makeURLSearchParams)(query),
2125
2193
  signal
2126
2194
  });
2127
2195
  }
@@ -2133,12 +2201,12 @@ var InvitesAPI = class {
2133
2201
  * @param options - The options for deleting the invite
2134
2202
  */
2135
2203
  async delete(code, { reason, signal } = {}) {
2136
- await this.rest.delete(import_v108.Routes.invite(code), { reason, signal });
2204
+ return this.rest.delete(import_v108.Routes.invite(code), { reason, signal });
2137
2205
  }
2138
2206
  };
2139
2207
 
2140
2208
  // src/api/monetization.ts
2141
- var import_rest5 = require("@discordjs/rest");
2209
+ var import_rest6 = require("@discordjs/rest");
2142
2210
  var import_v109 = require("discord-api-types/v10");
2143
2211
  var MonetizationAPI = class {
2144
2212
  constructor(rest) {
@@ -2150,30 +2218,71 @@ var MonetizationAPI = class {
2150
2218
  /**
2151
2219
  * Fetches the SKUs for an application.
2152
2220
  *
2153
- * @see {@link https://discord.com/developers/docs/monetization/skus#list-skus}
2221
+ * @see {@link https://discord.com/developers/docs/resources/sku#list-skus}
2222
+ * @param applicationId - The application id to fetch SKUs for
2154
2223
  * @param options - The options for fetching the SKUs.
2155
2224
  */
2156
2225
  async getSKUs(applicationId, { signal } = {}) {
2157
2226
  return this.rest.get(import_v109.Routes.skus(applicationId), { signal });
2158
2227
  }
2228
+ /**
2229
+ * Fetches subscriptions for an SKU.
2230
+ *
2231
+ * @see {@link https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions}
2232
+ * @param skuId - The SKU id to fetch subscriptions for
2233
+ * @param query - The query options for fetching subscriptions
2234
+ * @param options - The options for fetching subscriptions
2235
+ */
2236
+ async getSKUSubscriptions(skuId, query = {}, { signal } = {}) {
2237
+ return this.rest.get(import_v109.Routes.skuSubscriptions(skuId), {
2238
+ signal,
2239
+ query: (0, import_rest6.makeURLSearchParams)(query)
2240
+ });
2241
+ }
2242
+ /**
2243
+ * Fetches a subscription for an SKU.
2244
+ *
2245
+ * @see {@link https://discord.com/developers/docs/resources/subscription#get-sku-subscription}
2246
+ * @param skuId - The SKU id to fetch subscription for
2247
+ * @param subscriptionId - The subscription id to fetch
2248
+ * @param options - The options for fetching the subscription
2249
+ */
2250
+ async getSKUSubscription(skuId, subscriptionId, { signal } = {}) {
2251
+ return this.rest.get(import_v109.Routes.skuSubscription(skuId, subscriptionId), {
2252
+ signal
2253
+ });
2254
+ }
2159
2255
  /**
2160
2256
  * Fetches the entitlements for an application.
2161
2257
  *
2162
- * @see {@link https://discord.com/developers/docs/monetization/entitlements#list-entitlements}
2258
+ * @see {@link https://discord.com/developers/docs/resources/entitlement#list-entitlements}
2163
2259
  * @param applicationId - The application id to fetch entitlements for
2164
2260
  * @param query - The query options for fetching entitlements
2165
2261
  * @param options - The options for fetching entitlements
2166
2262
  */
2167
- async getEntitlements(applicationId, query, { signal } = {}) {
2263
+ async getEntitlements(applicationId, query = {}, { signal } = {}) {
2168
2264
  return this.rest.get(import_v109.Routes.entitlements(applicationId), {
2169
2265
  signal,
2170
- query: (0, import_rest5.makeURLSearchParams)(query)
2266
+ query: (0, import_rest6.makeURLSearchParams)(query)
2267
+ });
2268
+ }
2269
+ /**
2270
+ * Fetches an entitlement for an application.
2271
+ *
2272
+ * @see {@link https://discord.com/developers/docs/resources/entitlement#get-entitlement}
2273
+ * @param applicationId - The application id to fetch the entitlement for
2274
+ * @param entitlementId - The entitlement id to fetch
2275
+ * @param options - The options for fetching the entitlement
2276
+ */
2277
+ async getEntitlement(applicationId, entitlementId, { signal } = {}) {
2278
+ return this.rest.get(import_v109.Routes.entitlement(applicationId, entitlementId), {
2279
+ signal
2171
2280
  });
2172
2281
  }
2173
2282
  /**
2174
2283
  * Creates a test entitlement for an application's SKU.
2175
2284
  *
2176
- * @see {@link https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement}
2285
+ * @see {@link https://discord.com/developers/docs/resources/entitlement#create-test-entitlement}
2177
2286
  * @param applicationId - The application id to create the entitlement for
2178
2287
  * @param body - The data for creating the entitlement
2179
2288
  * @param options - The options for creating the entitlement
@@ -2187,7 +2296,7 @@ var MonetizationAPI = class {
2187
2296
  /**
2188
2297
  * Deletes a test entitlement for an application's SKU.
2189
2298
  *
2190
- * @see {@link https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement}
2299
+ * @see {@link https://discord.com/developers/docs/resources/entitlement#delete-test-entitlement}
2191
2300
  * @param applicationId - The application id to delete the entitlement for
2192
2301
  * @param entitlementId - The entitlement id to delete
2193
2302
  * @param options - The options for deleting the entitlement
@@ -2198,7 +2307,7 @@ var MonetizationAPI = class {
2198
2307
  /**
2199
2308
  * Marks a given entitlement for the user as consumed. Only available for One-Time Purchase consumable SKUs.
2200
2309
  *
2201
- * @see {@link https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement}
2310
+ * @see {@link https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement}
2202
2311
  * @param applicationId - The application id to consume the entitlement for
2203
2312
  * @param entitlementId - The entitlement id to consume
2204
2313
  * @param options - The options for consuming the entitlement
@@ -2209,7 +2318,7 @@ var MonetizationAPI = class {
2209
2318
  };
2210
2319
 
2211
2320
  // src/api/oauth2.ts
2212
- var import_rest6 = require("@discordjs/rest");
2321
+ var import_rest7 = require("@discordjs/rest");
2213
2322
  var import_v1010 = require("discord-api-types/v10");
2214
2323
  var OAuth2API = class {
2215
2324
  constructor(rest) {
@@ -2226,7 +2335,7 @@ var OAuth2API = class {
2226
2335
  */
2227
2336
  generateAuthorizationURL(options) {
2228
2337
  const url = new URL(`${import_v1010.RouteBases.api}${import_v1010.Routes.oauth2Authorization()}`);
2229
- url.search = (0, import_rest6.makeURLSearchParams)(options).toString();
2338
+ url.search = (0, import_rest7.makeURLSearchParams)(options).toString();
2230
2339
  return url.toString();
2231
2340
  }
2232
2341
  /**
@@ -2238,7 +2347,7 @@ var OAuth2API = class {
2238
2347
  */
2239
2348
  async tokenExchange(body, { signal } = {}) {
2240
2349
  return this.rest.post(import_v1010.Routes.oauth2TokenExchange(), {
2241
- body: (0, import_rest6.makeURLSearchParams)(body),
2350
+ body: (0, import_rest7.makeURLSearchParams)(body),
2242
2351
  passThroughBody: true,
2243
2352
  headers: {
2244
2353
  "Content-Type": "application/x-www-form-urlencoded"
@@ -2256,7 +2365,7 @@ var OAuth2API = class {
2256
2365
  */
2257
2366
  async refreshToken(body, { signal } = {}) {
2258
2367
  return this.rest.post(import_v1010.Routes.oauth2TokenExchange(), {
2259
- body: (0, import_rest6.makeURLSearchParams)(body),
2368
+ body: (0, import_rest7.makeURLSearchParams)(body),
2260
2369
  passThroughBody: true,
2261
2370
  headers: {
2262
2371
  "Content-Type": "application/x-www-form-urlencoded"
@@ -2276,7 +2385,7 @@ var OAuth2API = class {
2276
2385
  */
2277
2386
  async getToken(body, { signal } = {}) {
2278
2387
  return this.rest.post(import_v1010.Routes.oauth2TokenExchange(), {
2279
- body: (0, import_rest6.makeURLSearchParams)(body),
2388
+ body: (0, import_rest7.makeURLSearchParams)(body),
2280
2389
  passThroughBody: true,
2281
2390
  headers: {
2282
2391
  "Content-Type": "application/x-www-form-urlencoded"
@@ -2318,7 +2427,7 @@ var OAuth2API = class {
2318
2427
  */
2319
2428
  async revokeToken(applicationId, applicationSecret, body, { signal } = {}) {
2320
2429
  await this.rest.post(import_v1010.Routes.oauth2TokenRevocation(), {
2321
- body: (0, import_rest6.makeURLSearchParams)(body),
2430
+ body: (0, import_rest7.makeURLSearchParams)(body),
2322
2431
  passThroughBody: true,
2323
2432
  headers: {
2324
2433
  Authorization: `Basic ${btoa(`${applicationId}:${applicationSecret}`)}`,
@@ -2331,7 +2440,7 @@ var OAuth2API = class {
2331
2440
  };
2332
2441
 
2333
2442
  // src/api/poll.ts
2334
- var import_rest7 = require("@discordjs/rest");
2443
+ var import_rest8 = require("@discordjs/rest");
2335
2444
  var import_v1011 = require("discord-api-types/v10");
2336
2445
  var PollAPI = class {
2337
2446
  constructor(rest) {
@@ -2350,10 +2459,10 @@ var PollAPI = class {
2350
2459
  * @param query - The query for getting the list of voters
2351
2460
  * @param options - The options for getting the list of voters
2352
2461
  */
2353
- async getAnswerVoters(channelId, messageId, answerId, query, { signal } = {}) {
2462
+ async getAnswerVoters(channelId, messageId, answerId, query = {}, { signal } = {}) {
2354
2463
  return this.rest.get(import_v1011.Routes.pollAnswerVoters(channelId, messageId, answerId), {
2355
2464
  signal,
2356
- query: (0, import_rest7.makeURLSearchParams)(query)
2465
+ query: (0, import_rest8.makeURLSearchParams)(query)
2357
2466
  });
2358
2467
  }
2359
2468
  /**
@@ -2408,8 +2517,30 @@ var RoleConnectionsAPI = class {
2408
2517
  }
2409
2518
  };
2410
2519
 
2411
- // src/api/stageInstances.ts
2520
+ // src/api/soundboardSounds.ts
2412
2521
  var import_v1013 = require("discord-api-types/v10");
2522
+ var SoundboardSoundsAPI = class {
2523
+ constructor(rest) {
2524
+ this.rest = rest;
2525
+ }
2526
+ static {
2527
+ __name(this, "SoundboardSoundsAPI");
2528
+ }
2529
+ /**
2530
+ * Fetches all the soundboard default sounds.
2531
+ *
2532
+ * @see {@link https://discord.com/developers/docs/resources/soundboard#list-default-soundboard-sounds}
2533
+ * @param options - The options for fetching the soundboard default sounds.
2534
+ */
2535
+ async getSoundboardDefaultSounds({ signal } = {}) {
2536
+ return this.rest.get(import_v1013.Routes.soundboardDefaultSounds(), {
2537
+ signal
2538
+ });
2539
+ }
2540
+ };
2541
+
2542
+ // src/api/stageInstances.ts
2543
+ var import_v1014 = require("discord-api-types/v10");
2413
2544
  var StageInstancesAPI = class {
2414
2545
  constructor(rest) {
2415
2546
  this.rest = rest;
@@ -2425,7 +2556,7 @@ var StageInstancesAPI = class {
2425
2556
  * @param options - The options for creating the new stage instance
2426
2557
  */
2427
2558
  async create(body, { reason, signal } = {}) {
2428
- return this.rest.post(import_v1013.Routes.stageInstances(), {
2559
+ return this.rest.post(import_v1014.Routes.stageInstances(), {
2429
2560
  body,
2430
2561
  reason,
2431
2562
  signal
@@ -2439,7 +2570,7 @@ var StageInstancesAPI = class {
2439
2570
  * @param options - The options for fetching the stage instance
2440
2571
  */
2441
2572
  async get(channelId, { signal } = {}) {
2442
- return this.rest.get(import_v1013.Routes.stageInstance(channelId), { signal });
2573
+ return this.rest.get(import_v1014.Routes.stageInstance(channelId), { signal });
2443
2574
  }
2444
2575
  /**
2445
2576
  * Edits a stage instance
@@ -2450,7 +2581,7 @@ var StageInstancesAPI = class {
2450
2581
  * @param options - The options for editing the stage instance
2451
2582
  */
2452
2583
  async edit(channelId, body, { reason, signal } = {}) {
2453
- return this.rest.patch(import_v1013.Routes.stageInstance(channelId), {
2584
+ return this.rest.patch(import_v1014.Routes.stageInstance(channelId), {
2454
2585
  body,
2455
2586
  reason,
2456
2587
  signal
@@ -2464,12 +2595,12 @@ var StageInstancesAPI = class {
2464
2595
  * @param options - The options for deleting the stage instance
2465
2596
  */
2466
2597
  async delete(channelId, { reason, signal } = {}) {
2467
- await this.rest.delete(import_v1013.Routes.stageInstance(channelId), { reason, signal });
2598
+ await this.rest.delete(import_v1014.Routes.stageInstance(channelId), { reason, signal });
2468
2599
  }
2469
2600
  };
2470
2601
 
2471
2602
  // src/api/sticker.ts
2472
- var import_v1014 = require("discord-api-types/v10");
2603
+ var import_v1015 = require("discord-api-types/v10");
2473
2604
  var StickersAPI = class {
2474
2605
  constructor(rest) {
2475
2606
  this.rest = rest;
@@ -2485,7 +2616,7 @@ var StickersAPI = class {
2485
2616
  * @param options - The options for fetching the sticker pack
2486
2617
  */
2487
2618
  async getStickerPack(packId, { signal } = {}) {
2488
- return this.rest.get(import_v1014.Routes.stickerPack(packId), { signal });
2619
+ return this.rest.get(import_v1015.Routes.stickerPack(packId), { signal });
2489
2620
  }
2490
2621
  /**
2491
2622
  * Fetches all of the sticker packs
@@ -2494,7 +2625,7 @@ var StickersAPI = class {
2494
2625
  * @param options - The options for fetching the sticker packs
2495
2626
  */
2496
2627
  async getStickers({ signal } = {}) {
2497
- return this.rest.get(import_v1014.Routes.stickerPacks(), { signal });
2628
+ return this.rest.get(import_v1015.Routes.stickerPacks(), { signal });
2498
2629
  }
2499
2630
  /**
2500
2631
  * Fetches all of the sticker packs
@@ -2514,12 +2645,12 @@ var StickersAPI = class {
2514
2645
  * @param options - The options for fetching the sticker
2515
2646
  */
2516
2647
  async get(stickerId, { signal } = {}) {
2517
- return this.rest.get(import_v1014.Routes.sticker(stickerId), { signal });
2648
+ return this.rest.get(import_v1015.Routes.sticker(stickerId), { signal });
2518
2649
  }
2519
2650
  };
2520
2651
 
2521
2652
  // src/api/thread.ts
2522
- var import_v1015 = require("discord-api-types/v10");
2653
+ var import_v1016 = require("discord-api-types/v10");
2523
2654
  var ThreadsAPI = class {
2524
2655
  constructor(rest) {
2525
2656
  this.rest = rest;
@@ -2535,7 +2666,7 @@ var ThreadsAPI = class {
2535
2666
  * @param options - The options for joining the thread
2536
2667
  */
2537
2668
  async join(threadId, { signal } = {}) {
2538
- await this.rest.put(import_v1015.Routes.threadMembers(threadId, "@me"), { signal });
2669
+ await this.rest.put(import_v1016.Routes.threadMembers(threadId, "@me"), { signal });
2539
2670
  }
2540
2671
  /**
2541
2672
  * Adds a member to a thread
@@ -2546,7 +2677,7 @@ var ThreadsAPI = class {
2546
2677
  * @param options - The options for adding the member to the thread
2547
2678
  */
2548
2679
  async addMember(threadId, userId, { signal } = {}) {
2549
- await this.rest.put(import_v1015.Routes.threadMembers(threadId, userId), { signal });
2680
+ await this.rest.put(import_v1016.Routes.threadMembers(threadId, userId), { signal });
2550
2681
  }
2551
2682
  /**
2552
2683
  * Removes the current user from a thread
@@ -2556,7 +2687,7 @@ var ThreadsAPI = class {
2556
2687
  * @param options - The options for leaving the thread
2557
2688
  */
2558
2689
  async leave(threadId, { signal } = {}) {
2559
- await this.rest.delete(import_v1015.Routes.threadMembers(threadId, "@me"), { signal });
2690
+ await this.rest.delete(import_v1016.Routes.threadMembers(threadId, "@me"), { signal });
2560
2691
  }
2561
2692
  /**
2562
2693
  * Removes a member from a thread
@@ -2567,7 +2698,7 @@ var ThreadsAPI = class {
2567
2698
  * @param options - The options for removing the member from the thread
2568
2699
  */
2569
2700
  async removeMember(threadId, userId, { signal } = {}) {
2570
- await this.rest.delete(import_v1015.Routes.threadMembers(threadId, userId), { signal });
2701
+ await this.rest.delete(import_v1016.Routes.threadMembers(threadId, userId), { signal });
2571
2702
  }
2572
2703
  /**
2573
2704
  * Fetches a member of a thread
@@ -2578,7 +2709,7 @@ var ThreadsAPI = class {
2578
2709
  * @param options - The options for fetching the member
2579
2710
  */
2580
2711
  async getMember(threadId, userId, { signal } = {}) {
2581
- return this.rest.get(import_v1015.Routes.threadMembers(threadId, userId), { signal });
2712
+ return this.rest.get(import_v1016.Routes.threadMembers(threadId, userId), { signal });
2582
2713
  }
2583
2714
  /**
2584
2715
  * Fetches all members of a thread
@@ -2588,13 +2719,13 @@ var ThreadsAPI = class {
2588
2719
  * @param options - The options for fetching the members
2589
2720
  */
2590
2721
  async getAllMembers(threadId, { signal } = {}) {
2591
- return this.rest.get(import_v1015.Routes.threadMembers(threadId), { signal });
2722
+ return this.rest.get(import_v1016.Routes.threadMembers(threadId), { signal });
2592
2723
  }
2593
2724
  };
2594
2725
 
2595
2726
  // src/api/user.ts
2596
- var import_rest8 = require("@discordjs/rest");
2597
- var import_v1016 = require("discord-api-types/v10");
2727
+ var import_rest9 = require("@discordjs/rest");
2728
+ var import_v1017 = require("discord-api-types/v10");
2598
2729
  var UsersAPI = class {
2599
2730
  constructor(rest) {
2600
2731
  this.rest = rest;
@@ -2610,7 +2741,7 @@ var UsersAPI = class {
2610
2741
  * @param options - The options for fetching the user
2611
2742
  */
2612
2743
  async get(userId, { signal } = {}) {
2613
- return this.rest.get(import_v1016.Routes.user(userId), { signal });
2744
+ return this.rest.get(import_v1017.Routes.user(userId), { signal });
2614
2745
  }
2615
2746
  /**
2616
2747
  * Returns the user object of the requester's account
@@ -2619,7 +2750,7 @@ var UsersAPI = class {
2619
2750
  * @param options - The options for fetching the current user
2620
2751
  */
2621
2752
  async getCurrent({ signal } = {}) {
2622
- return this.rest.get(import_v1016.Routes.user("@me"), { signal });
2753
+ return this.rest.get(import_v1017.Routes.user("@me"), { signal });
2623
2754
  }
2624
2755
  /**
2625
2756
  * Returns a list of partial guild objects the current user is a member of
@@ -2629,8 +2760,8 @@ var UsersAPI = class {
2629
2760
  * @param options - The options for fetching the guilds
2630
2761
  */
2631
2762
  async getGuilds(query = {}, { signal } = {}) {
2632
- return this.rest.get(import_v1016.Routes.userGuilds(), {
2633
- query: (0, import_rest8.makeURLSearchParams)(query),
2763
+ return this.rest.get(import_v1017.Routes.userGuilds(), {
2764
+ query: (0, import_rest9.makeURLSearchParams)(query),
2634
2765
  signal
2635
2766
  });
2636
2767
  }
@@ -2642,7 +2773,7 @@ var UsersAPI = class {
2642
2773
  * @param options - The options for leaving the guild
2643
2774
  */
2644
2775
  async leaveGuild(guildId, { signal } = {}) {
2645
- await this.rest.delete(import_v1016.Routes.userGuild(guildId), { signal });
2776
+ await this.rest.delete(import_v1017.Routes.userGuild(guildId), { signal });
2646
2777
  }
2647
2778
  /**
2648
2779
  * Edits the current user
@@ -2652,7 +2783,7 @@ var UsersAPI = class {
2652
2783
  * @param options - The options for editing the user
2653
2784
  */
2654
2785
  async edit(body, { signal } = {}) {
2655
- return this.rest.patch(import_v1016.Routes.user("@me"), { body, signal });
2786
+ return this.rest.patch(import_v1017.Routes.user("@me"), { body, signal });
2656
2787
  }
2657
2788
  /**
2658
2789
  * Fetches the guild member for the current user
@@ -2662,7 +2793,7 @@ var UsersAPI = class {
2662
2793
  * @param options - The options for fetching the guild member
2663
2794
  */
2664
2795
  async getGuildMember(guildId, { signal } = {}) {
2665
- return this.rest.get(import_v1016.Routes.userGuildMember(guildId), { signal });
2796
+ return this.rest.get(import_v1017.Routes.userGuildMember(guildId), { signal });
2666
2797
  }
2667
2798
  /**
2668
2799
  * Edits the guild member for the current user
@@ -2673,7 +2804,7 @@ var UsersAPI = class {
2673
2804
  * @param options - The options for editing the guild member
2674
2805
  */
2675
2806
  async editCurrentGuildMember(guildId, body = {}, { reason, signal } = {}) {
2676
- return this.rest.patch(import_v1016.Routes.guildMember(guildId, "@me"), {
2807
+ return this.rest.patch(import_v1017.Routes.guildMember(guildId, "@me"), {
2677
2808
  reason,
2678
2809
  body,
2679
2810
  signal
@@ -2687,7 +2818,7 @@ var UsersAPI = class {
2687
2818
  * @param options - The options for opening the DM
2688
2819
  */
2689
2820
  async createDM(userId, { signal } = {}) {
2690
- return this.rest.post(import_v1016.Routes.userChannels(), {
2821
+ return this.rest.post(import_v1017.Routes.userChannels(), {
2691
2822
  body: { recipient_id: userId },
2692
2823
  signal
2693
2824
  });
@@ -2699,7 +2830,7 @@ var UsersAPI = class {
2699
2830
  * @param options - The options for fetching the user's connections
2700
2831
  */
2701
2832
  async getConnections({ signal } = {}) {
2702
- return this.rest.get(import_v1016.Routes.userConnections(), { signal });
2833
+ return this.rest.get(import_v1017.Routes.userConnections(), { signal });
2703
2834
  }
2704
2835
  /**
2705
2836
  * Gets the current user's active application role connection
@@ -2709,7 +2840,7 @@ var UsersAPI = class {
2709
2840
  * @param options - The options for fetching the role connections
2710
2841
  */
2711
2842
  async getApplicationRoleConnection(applicationId, { signal } = {}) {
2712
- return this.rest.get(import_v1016.Routes.userApplicationRoleConnection(applicationId), {
2843
+ return this.rest.get(import_v1017.Routes.userApplicationRoleConnection(applicationId), {
2713
2844
  signal
2714
2845
  });
2715
2846
  }
@@ -2722,7 +2853,7 @@ var UsersAPI = class {
2722
2853
  * @param options - The options for updating the application role connection
2723
2854
  */
2724
2855
  async updateApplicationRoleConnection(applicationId, body, { signal } = {}) {
2725
- return this.rest.put(import_v1016.Routes.userApplicationRoleConnection(applicationId), {
2856
+ return this.rest.put(import_v1017.Routes.userApplicationRoleConnection(applicationId), {
2726
2857
  body,
2727
2858
  signal
2728
2859
  });
@@ -2730,8 +2861,8 @@ var UsersAPI = class {
2730
2861
  };
2731
2862
 
2732
2863
  // src/api/webhook.ts
2733
- var import_rest9 = require("@discordjs/rest");
2734
- var import_v1017 = require("discord-api-types/v10");
2864
+ var import_rest10 = require("@discordjs/rest");
2865
+ var import_v1018 = require("discord-api-types/v10");
2735
2866
  var WebhooksAPI = class {
2736
2867
  constructor(rest) {
2737
2868
  this.rest = rest;
@@ -2748,7 +2879,7 @@ var WebhooksAPI = class {
2748
2879
  * @param options - The options for fetching the webhook
2749
2880
  */
2750
2881
  async get(id, { token, signal } = {}) {
2751
- return this.rest.get(import_v1017.Routes.webhook(id, token), {
2882
+ return this.rest.get(import_v1018.Routes.webhook(id, token), {
2752
2883
  signal,
2753
2884
  auth: !token
2754
2885
  });
@@ -2763,7 +2894,7 @@ var WebhooksAPI = class {
2763
2894
  * @param options - The options for editing the webhook
2764
2895
  */
2765
2896
  async edit(id, body, { token, reason, signal } = {}) {
2766
- return this.rest.patch(import_v1017.Routes.webhook(id, token), {
2897
+ return this.rest.patch(import_v1018.Routes.webhook(id, token), {
2767
2898
  reason,
2768
2899
  body,
2769
2900
  signal,
@@ -2779,7 +2910,7 @@ var WebhooksAPI = class {
2779
2910
  * @param options - The options for deleting the webhook
2780
2911
  */
2781
2912
  async delete(id, { token, reason, signal } = {}) {
2782
- await this.rest.delete(import_v1017.Routes.webhook(id, token), {
2913
+ await this.rest.delete(import_v1018.Routes.webhook(id, token), {
2783
2914
  reason,
2784
2915
  signal,
2785
2916
  auth: !token
@@ -2794,15 +2925,9 @@ var WebhooksAPI = class {
2794
2925
  * @param body - The data for executing the webhook
2795
2926
  * @param options - The options for executing the webhook
2796
2927
  */
2797
- async execute(id, token, {
2798
- wait,
2799
- thread_id,
2800
- with_components,
2801
- files,
2802
- ...body
2803
- }, { signal } = {}) {
2804
- return this.rest.post(import_v1017.Routes.webhook(id, token), {
2805
- query: (0, import_rest9.makeURLSearchParams)({ wait, thread_id, with_components }),
2928
+ async execute(id, token, { wait, thread_id, with_components, files, ...body }, { signal } = {}) {
2929
+ return this.rest.post(import_v1018.Routes.webhook(id, token), {
2930
+ query: (0, import_rest10.makeURLSearchParams)({ wait, thread_id, with_components }),
2806
2931
  files,
2807
2932
  body,
2808
2933
  auth: false,
@@ -2821,8 +2946,8 @@ var WebhooksAPI = class {
2821
2946
  * @param options - The options for executing the webhook
2822
2947
  */
2823
2948
  async executeSlack(id, token, body, query = {}, { signal } = {}) {
2824
- await this.rest.post(import_v1017.Routes.webhookPlatform(id, token, "slack"), {
2825
- query: (0, import_rest9.makeURLSearchParams)(query),
2949
+ await this.rest.post(import_v1018.Routes.webhookPlatform(id, token, "slack"), {
2950
+ query: (0, import_rest10.makeURLSearchParams)(query),
2826
2951
  body,
2827
2952
  auth: false,
2828
2953
  signal
@@ -2839,8 +2964,8 @@ var WebhooksAPI = class {
2839
2964
  * @param options - The options for executing the webhook
2840
2965
  */
2841
2966
  async executeGitHub(id, token, body, query = {}, { signal } = {}) {
2842
- await this.rest.post(import_v1017.Routes.webhookPlatform(id, token, "github"), {
2843
- query: (0, import_rest9.makeURLSearchParams)(query),
2967
+ await this.rest.post(import_v1018.Routes.webhookPlatform(id, token, "github"), {
2968
+ query: (0, import_rest10.makeURLSearchParams)(query),
2844
2969
  body,
2845
2970
  signal,
2846
2971
  auth: false
@@ -2857,8 +2982,8 @@ var WebhooksAPI = class {
2857
2982
  * @param options - The options for fetching the message
2858
2983
  */
2859
2984
  async getMessage(id, token, messageId, query = {}, { signal } = {}) {
2860
- return this.rest.get(import_v1017.Routes.webhookMessage(id, token, messageId), {
2861
- query: (0, import_rest9.makeURLSearchParams)(query),
2985
+ return this.rest.get(import_v1018.Routes.webhookMessage(id, token, messageId), {
2986
+ query: (0, import_rest10.makeURLSearchParams)(query),
2862
2987
  auth: false,
2863
2988
  signal
2864
2989
  });
@@ -2873,14 +2998,9 @@ var WebhooksAPI = class {
2873
2998
  * @param body - The data for editing the message
2874
2999
  * @param options - The options for editing the message
2875
3000
  */
2876
- async editMessage(id, token, messageId, {
2877
- thread_id,
2878
- with_components,
2879
- files,
2880
- ...body
2881
- }, { signal } = {}) {
2882
- return this.rest.patch(import_v1017.Routes.webhookMessage(id, token, messageId), {
2883
- query: (0, import_rest9.makeURLSearchParams)({ thread_id, with_components }),
3001
+ async editMessage(id, token, messageId, { thread_id, with_components, files, ...body }, { signal } = {}) {
3002
+ return this.rest.patch(import_v1018.Routes.webhookMessage(id, token, messageId), {
3003
+ query: (0, import_rest10.makeURLSearchParams)({ thread_id, with_components }),
2884
3004
  auth: false,
2885
3005
  body,
2886
3006
  signal,
@@ -2898,8 +3018,8 @@ var WebhooksAPI = class {
2898
3018
  * @param options - The options for deleting the message
2899
3019
  */
2900
3020
  async deleteMessage(id, token, messageId, query = {}, { signal } = {}) {
2901
- await this.rest.delete(import_v1017.Routes.webhookMessage(id, token, messageId), {
2902
- query: (0, import_rest9.makeURLSearchParams)(query),
3021
+ await this.rest.delete(import_v1018.Routes.webhookMessage(id, token, messageId), {
3022
+ query: (0, import_rest10.makeURLSearchParams)(query),
2903
3023
  auth: false,
2904
3024
  signal
2905
3025
  });
@@ -2920,6 +3040,7 @@ var API = class {
2920
3040
  this.oauth2 = new OAuth2API(rest);
2921
3041
  this.poll = new PollAPI(rest);
2922
3042
  this.roleConnections = new RoleConnectionsAPI(rest);
3043
+ this.soundboardSounds = new SoundboardSoundsAPI(rest);
2923
3044
  this.stageInstances = new StageInstancesAPI(rest);
2924
3045
  this.stickers = new StickersAPI(rest);
2925
3046
  this.threads = new ThreadsAPI(rest);
@@ -2942,6 +3063,7 @@ var API = class {
2942
3063
  oauth2;
2943
3064
  poll;
2944
3065
  roleConnections;
3066
+ soundboardSounds;
2945
3067
  stageInstances;
2946
3068
  stickers;
2947
3069
  threads;
@@ -2956,7 +3078,11 @@ var import_util = require("@discordjs/util");
2956
3078
  var import_ws = require("@discordjs/ws");
2957
3079
  var import_snowflake = require("@sapphire/snowflake");
2958
3080
  var import_async_event_emitter = require("@vladfrangu/async_event_emitter");
2959
- var import_v1018 = require("discord-api-types/v10");
3081
+ var import_v1019 = require("discord-api-types/v10");
3082
+ function createTimer(controller, timeout) {
3083
+ return (0, import_node_timers.setTimeout)(() => controller.abort(), timeout);
3084
+ }
3085
+ __name(createTimer, "createTimer");
2960
3086
  var Client = class extends import_async_event_emitter.AsyncEventEmitter {
2961
3087
  static {
2962
3088
  __name(this, "Client");
@@ -2991,12 +3117,21 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
2991
3117
  const shardId = (0, import_util.calculateShardId)(options.guild_id, await this.gateway.getShardCount());
2992
3118
  const nonce = options.nonce ?? import_snowflake.DiscordSnowflake.generate().toString();
2993
3119
  const controller = new AbortController();
2994
- const createTimer = /* @__PURE__ */ __name(() => (0, import_node_timers.setTimeout)(() => {
2995
- controller.abort();
2996
- }, timeout), "createTimer");
2997
- let timer = createTimer();
3120
+ let timer = createTimer(controller, timeout);
3121
+ const onRatelimit = /* @__PURE__ */ __name(({ data }) => {
3122
+ if (data.meta.nonce === nonce) {
3123
+ controller.abort(new import_util.GatewayRateLimitError(data, options));
3124
+ }
3125
+ }, "onRatelimit");
3126
+ const cleanup = /* @__PURE__ */ __name(() => {
3127
+ if (timer) {
3128
+ (0, import_node_timers.clearTimeout)(timer);
3129
+ }
3130
+ this.off(import_v1019.GatewayDispatchEvents.RateLimited, onRatelimit);
3131
+ }, "cleanup");
3132
+ this.on(import_v1019.GatewayDispatchEvents.RateLimited, onRatelimit);
2998
3133
  await this.gateway.send(shardId, {
2999
- op: import_v1018.GatewayOpcodes.RequestGuildMembers,
3134
+ op: import_v1019.GatewayOpcodes.RequestGuildMembers,
3000
3135
  // eslint-disable-next-line id-length
3001
3136
  d: {
3002
3137
  ...options,
@@ -3004,7 +3139,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
3004
3139
  }
3005
3140
  });
3006
3141
  try {
3007
- const iterator = import_async_event_emitter.AsyncEventEmitter.on(this, import_v1018.GatewayDispatchEvents.GuildMembersChunk, {
3142
+ const iterator = import_async_event_emitter.AsyncEventEmitter.on(this, import_v1019.GatewayDispatchEvents.GuildMembersChunk, {
3008
3143
  signal: controller.signal
3009
3144
  });
3010
3145
  for await (const [{ data }] of iterator) {
@@ -3019,21 +3154,19 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
3019
3154
  chunkIndex: data.chunk_index,
3020
3155
  chunkCount: data.chunk_count
3021
3156
  };
3022
- if (data.chunk_index >= data.chunk_count - 1) {
3023
- break;
3024
- } else {
3025
- timer = createTimer();
3026
- }
3157
+ if (data.chunk_index >= data.chunk_count - 1) break;
3158
+ timer = createTimer(controller, timeout);
3027
3159
  }
3028
3160
  } catch (error) {
3029
3161
  if (error instanceof Error && error.name === "AbortError") {
3162
+ if (error.cause instanceof import_util.GatewayRateLimitError) {
3163
+ throw error.cause;
3164
+ }
3030
3165
  throw new Error("Request timed out");
3031
3166
  }
3032
3167
  throw error;
3033
3168
  } finally {
3034
- if (timer) {
3035
- (0, import_node_timers.clearTimeout)(timer);
3036
- }
3169
+ cleanup();
3037
3170
  }
3038
3171
  }
3039
3172
  /**
@@ -3060,6 +3193,86 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
3060
3193
  }
3061
3194
  return { members, nonce, notFound, presences };
3062
3195
  }
3196
+ /**
3197
+ * Requests soundboard sounds from the gateway and returns an async iterator that yields the data from each soundboard sounds event.
3198
+ *
3199
+ * @see {@link https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds}
3200
+ * @param options - The options for the request
3201
+ * @param timeout - The timeout for waiting for each soundboard sounds
3202
+ * @example
3203
+ * Requesting soundboard sounds for specific guilds
3204
+ * ```ts
3205
+ * for await (const { guildId, soundboardSounds } of this.requestSoundboardSoundsIterator({
3206
+ * guild_ids: ['1234567890', '9876543210'],
3207
+ * })) {
3208
+ * console.log(`Soundboard sounds for guild ${guildId}:`, soundboardSounds);
3209
+ * }
3210
+ * ```
3211
+ */
3212
+ async *requestSoundboardSoundsIterator(options, timeout = 1e4) {
3213
+ const shardCount = await this.gateway.getShardCount();
3214
+ const shardIds = Map.groupBy(options.guild_ids, (guildId) => (0, import_util.calculateShardId)(guildId, shardCount));
3215
+ const controller = new AbortController();
3216
+ let timer = createTimer(controller, timeout);
3217
+ for (const [shardId, guildIds] of shardIds) {
3218
+ await this.gateway.send(shardId, {
3219
+ op: import_v1019.GatewayOpcodes.RequestSoundboardSounds,
3220
+ // eslint-disable-next-line id-length
3221
+ d: {
3222
+ ...options,
3223
+ guild_ids: guildIds
3224
+ }
3225
+ });
3226
+ }
3227
+ try {
3228
+ const iterator = import_async_event_emitter.AsyncEventEmitter.on(this, import_v1019.GatewayDispatchEvents.SoundboardSounds, {
3229
+ signal: controller.signal
3230
+ });
3231
+ const guildIds = new Set(options.guild_ids);
3232
+ for await (const [{ data }] of iterator) {
3233
+ if (!guildIds.has(data.guild_id)) continue;
3234
+ (0, import_node_timers.clearTimeout)(timer);
3235
+ timer = void 0;
3236
+ yield {
3237
+ guildId: data.guild_id,
3238
+ soundboardSounds: data.soundboard_sounds
3239
+ };
3240
+ guildIds.delete(data.guild_id);
3241
+ if (guildIds.size === 0) break;
3242
+ timer = createTimer(controller, timeout);
3243
+ }
3244
+ } catch (error) {
3245
+ if (error instanceof Error && error.name === "AbortError") {
3246
+ throw new Error("Request timed out");
3247
+ }
3248
+ throw error;
3249
+ } finally {
3250
+ if (timer) {
3251
+ (0, import_node_timers.clearTimeout)(timer);
3252
+ }
3253
+ }
3254
+ }
3255
+ /**
3256
+ * Requests soundboard sounds from the gateway.
3257
+ *
3258
+ * @see {@link https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds}
3259
+ * @param options - The options for the request
3260
+ * @param timeout - The timeout for waiting for each soundboard sounds event
3261
+ * @example
3262
+ * Requesting soundboard sounds for specific guilds
3263
+ * ```ts
3264
+ * const soundboardSounds = await client.requestSoundboardSounds({ guild_ids: ['1234567890', '9876543210'], });
3265
+ *
3266
+ * console.log(soundboardSounds.get('1234567890'));
3267
+ * ```
3268
+ */
3269
+ async requestSoundboardSounds(options, timeout = 1e4) {
3270
+ const soundboardSounds = /* @__PURE__ */ new Map();
3271
+ for await (const data of this.requestSoundboardSoundsIterator(options, timeout)) {
3272
+ soundboardSounds.set(data.guildId, data.soundboardSounds);
3273
+ }
3274
+ return soundboardSounds;
3275
+ }
3063
3276
  /**
3064
3277
  * Updates the voice state of the bot user
3065
3278
  *
@@ -3069,7 +3282,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
3069
3282
  async updateVoiceState(options) {
3070
3283
  const shardId = (0, import_util.calculateShardId)(options.guild_id, await this.gateway.getShardCount());
3071
3284
  await this.gateway.send(shardId, {
3072
- op: import_v1018.GatewayOpcodes.VoiceStateUpdate,
3285
+ op: import_v1019.GatewayOpcodes.VoiceStateUpdate,
3073
3286
  // eslint-disable-next-line id-length
3074
3287
  d: options
3075
3288
  });
@@ -3082,7 +3295,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
3082
3295
  */
3083
3296
  async updatePresence(shardId, options) {
3084
3297
  await this.gateway.send(shardId, {
3085
- op: import_v1018.GatewayOpcodes.PresenceUpdate,
3298
+ op: import_v1019.GatewayOpcodes.PresenceUpdate,
3086
3299
  // eslint-disable-next-line id-length
3087
3300
  d: options
3088
3301
  });
@@ -3114,8 +3327,9 @@ function withFiles(files, options) {
3114
3327
  __name(withFiles, "withFiles");
3115
3328
 
3116
3329
  // src/index.ts
3117
- __reExport(src_exports, require("discord-api-types/v10"), module.exports);
3118
- var version = "2.3.0";
3330
+ __reExport(index_exports, require("discord-api-types/v10"), module.exports);
3331
+ var import_util2 = require("@discordjs/util");
3332
+ var version = "2.5.0";
3119
3333
  // Annotate the CommonJS export names for ESM import in node:
3120
3334
  0 && (module.exports = {
3121
3335
  API,
@@ -3124,6 +3338,7 @@ var version = "2.3.0";
3124
3338
  ChannelsAPI,
3125
3339
  Client,
3126
3340
  GatewayAPI,
3341
+ GatewayRateLimitError,
3127
3342
  GuildsAPI,
3128
3343
  InteractionsAPI,
3129
3344
  InvitesAPI,
@@ -3131,6 +3346,7 @@ var version = "2.3.0";
3131
3346
  OAuth2API,
3132
3347
  PollAPI,
3133
3348
  RoleConnectionsAPI,
3349
+ SoundboardSoundsAPI,
3134
3350
  StageInstancesAPI,
3135
3351
  StickersAPI,
3136
3352
  ThreadsAPI,