@discordjs/core 1.1.2-dev.1703117367-891a67ac4 → 1.2.0-dev.1703462992-0f1e02b3d
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/http-only.d.mts +51 -2
- package/dist/http-only.d.ts +51 -2
- package/dist/http-only.js +145 -64
- package/dist/http-only.js.map +1 -1
- package/dist/http-only.mjs +150 -65
- package/dist/http-only.mjs.map +1 -1
- package/dist/index.d.mts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +151 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -67
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ __export(src_exports, {
|
|
|
30
30
|
GuildsAPI: () => GuildsAPI,
|
|
31
31
|
InteractionsAPI: () => InteractionsAPI,
|
|
32
32
|
InvitesAPI: () => InvitesAPI,
|
|
33
|
+
MonetizationAPI: () => MonetizationAPI,
|
|
33
34
|
OAuth2API: () => OAuth2API,
|
|
34
35
|
RoleConnectionsAPI: () => RoleConnectionsAPI,
|
|
35
36
|
StageInstancesAPI: () => StageInstancesAPI,
|
|
@@ -1825,6 +1826,23 @@ var InteractionsAPI = class {
|
|
|
1825
1826
|
signal
|
|
1826
1827
|
});
|
|
1827
1828
|
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Sends a premium required response to an interaction
|
|
1831
|
+
*
|
|
1832
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1833
|
+
* @param interactionId - The id of the interaction
|
|
1834
|
+
* @param interactionToken - The token of the interaction
|
|
1835
|
+
* @param options - The options for sending the premium required response
|
|
1836
|
+
*/
|
|
1837
|
+
async sendPremiumRequired(interactionId, interactionToken, { signal } = {}) {
|
|
1838
|
+
await this.rest.post(import_v105.Routes.interactionCallback(interactionId, interactionToken), {
|
|
1839
|
+
auth: false,
|
|
1840
|
+
body: {
|
|
1841
|
+
type: import_v105.InteractionResponseType.PremiumRequired
|
|
1842
|
+
},
|
|
1843
|
+
signal
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1828
1846
|
};
|
|
1829
1847
|
|
|
1830
1848
|
// src/api/invite.ts
|
|
@@ -1863,10 +1881,70 @@ var InvitesAPI = class {
|
|
|
1863
1881
|
}
|
|
1864
1882
|
};
|
|
1865
1883
|
|
|
1866
|
-
// src/api/
|
|
1867
|
-
var import_node_url = require("url");
|
|
1884
|
+
// src/api/monetization.ts
|
|
1868
1885
|
var import_rest5 = require("@discordjs/rest");
|
|
1869
1886
|
var import_v107 = require("discord-api-types/v10");
|
|
1887
|
+
var MonetizationAPI = class {
|
|
1888
|
+
constructor(rest) {
|
|
1889
|
+
this.rest = rest;
|
|
1890
|
+
}
|
|
1891
|
+
static {
|
|
1892
|
+
__name(this, "MonetizationAPI");
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Fetches the SKUs for an application.
|
|
1896
|
+
*
|
|
1897
|
+
* @see {@link https://discord.com/developers/docs/monetization/skus#list-skus}
|
|
1898
|
+
* @param options - The options for fetching the SKUs.
|
|
1899
|
+
*/
|
|
1900
|
+
async getSKUs(applicationId, { signal } = {}) {
|
|
1901
|
+
return this.rest.get(import_v107.Routes.skus(applicationId), { signal });
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Fetches the entitlements for an application.
|
|
1905
|
+
*
|
|
1906
|
+
* @see {@link https://discord.com/developers/docs/monetization/entitlements#list-entitlements}
|
|
1907
|
+
* @param applicationId - The application id to fetch entitlements for
|
|
1908
|
+
* @param query - The query options for fetching entitlements
|
|
1909
|
+
* @param options - The options for fetching entitlements
|
|
1910
|
+
*/
|
|
1911
|
+
async getEntitlements(applicationId, query, { signal } = {}) {
|
|
1912
|
+
return this.rest.get(import_v107.Routes.entitlements(applicationId), {
|
|
1913
|
+
signal,
|
|
1914
|
+
query: (0, import_rest5.makeURLSearchParams)(query)
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Creates a test entitlement for an application's SKU.
|
|
1919
|
+
*
|
|
1920
|
+
* @see {@link https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement}
|
|
1921
|
+
* @param applicationId - The application id to create the entitlement for
|
|
1922
|
+
* @param body - The data for creating the entitlement
|
|
1923
|
+
* @param options - The options for creating the entitlement
|
|
1924
|
+
*/
|
|
1925
|
+
async createTestEntitlement(applicationId, body, { signal } = {}) {
|
|
1926
|
+
return this.rest.post(import_v107.Routes.entitlements(applicationId), {
|
|
1927
|
+
body,
|
|
1928
|
+
signal
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Deletes a test entitlement for an application's SKU.
|
|
1933
|
+
*
|
|
1934
|
+
* @see {@link https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement}
|
|
1935
|
+
* @param applicationId - The application id to delete the entitlement for
|
|
1936
|
+
* @param entitlementId - The entitlement id to delete
|
|
1937
|
+
* @param options - The options for deleting the entitlement
|
|
1938
|
+
*/
|
|
1939
|
+
async deleteTestEntitlement(applicationId, entitlementId, { signal } = {}) {
|
|
1940
|
+
await this.rest.delete(import_v107.Routes.entitlement(applicationId, entitlementId), { signal });
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
// src/api/oauth2.ts
|
|
1945
|
+
var import_node_url = require("url");
|
|
1946
|
+
var import_rest6 = require("@discordjs/rest");
|
|
1947
|
+
var import_v108 = require("discord-api-types/v10");
|
|
1870
1948
|
var OAuth2API = class {
|
|
1871
1949
|
constructor(rest) {
|
|
1872
1950
|
this.rest = rest;
|
|
@@ -1881,8 +1959,8 @@ var OAuth2API = class {
|
|
|
1881
1959
|
* @param options - The options for creating the authorization URL
|
|
1882
1960
|
*/
|
|
1883
1961
|
generateAuthorizationURL(options) {
|
|
1884
|
-
const url = new import_node_url.URL(`${
|
|
1885
|
-
url.search = (0,
|
|
1962
|
+
const url = new import_node_url.URL(`${import_v108.RouteBases.api}${import_v108.Routes.oauth2Authorization()}`);
|
|
1963
|
+
url.search = (0, import_rest6.makeURLSearchParams)(options).toString();
|
|
1886
1964
|
return url.toString();
|
|
1887
1965
|
}
|
|
1888
1966
|
/**
|
|
@@ -1893,8 +1971,8 @@ var OAuth2API = class {
|
|
|
1893
1971
|
* @param options - The options for the token exchange request
|
|
1894
1972
|
*/
|
|
1895
1973
|
async tokenExchange(body, { signal } = {}) {
|
|
1896
|
-
return this.rest.post(
|
|
1897
|
-
body: (0,
|
|
1974
|
+
return this.rest.post(import_v108.Routes.oauth2TokenExchange(), {
|
|
1975
|
+
body: (0, import_rest6.makeURLSearchParams)(body),
|
|
1898
1976
|
passThroughBody: true,
|
|
1899
1977
|
headers: {
|
|
1900
1978
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -1910,8 +1988,8 @@ var OAuth2API = class {
|
|
|
1910
1988
|
* @param options - The options for the refresh token request
|
|
1911
1989
|
*/
|
|
1912
1990
|
async refreshToken(body, { signal } = {}) {
|
|
1913
|
-
return this.rest.post(
|
|
1914
|
-
body: (0,
|
|
1991
|
+
return this.rest.post(import_v108.Routes.oauth2TokenExchange(), {
|
|
1992
|
+
body: (0, import_rest6.makeURLSearchParams)(body),
|
|
1915
1993
|
passThroughBody: true,
|
|
1916
1994
|
headers: {
|
|
1917
1995
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -1929,8 +2007,8 @@ var OAuth2API = class {
|
|
|
1929
2007
|
* @param options - The options for the client credentials grant request
|
|
1930
2008
|
*/
|
|
1931
2009
|
async getToken(body, { signal } = {}) {
|
|
1932
|
-
return this.rest.post(
|
|
1933
|
-
body: (0,
|
|
2010
|
+
return this.rest.post(import_v108.Routes.oauth2TokenExchange(), {
|
|
2011
|
+
body: (0, import_rest6.makeURLSearchParams)(body),
|
|
1934
2012
|
passThroughBody: true,
|
|
1935
2013
|
headers: {
|
|
1936
2014
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -1945,7 +2023,7 @@ var OAuth2API = class {
|
|
|
1945
2023
|
* @param options - The options for the current bot application information request
|
|
1946
2024
|
*/
|
|
1947
2025
|
async getCurrentBotApplicationInformation({ signal } = {}) {
|
|
1948
|
-
return this.rest.get(
|
|
2026
|
+
return this.rest.get(import_v108.Routes.oauth2CurrentApplication(), {
|
|
1949
2027
|
signal
|
|
1950
2028
|
});
|
|
1951
2029
|
}
|
|
@@ -1956,14 +2034,14 @@ var OAuth2API = class {
|
|
|
1956
2034
|
* @param options - The options for the current authorization information request
|
|
1957
2035
|
*/
|
|
1958
2036
|
async getCurrentAuthorizationInformation({ signal } = {}) {
|
|
1959
|
-
return this.rest.get(
|
|
2037
|
+
return this.rest.get(import_v108.Routes.oauth2CurrentAuthorization(), {
|
|
1960
2038
|
signal
|
|
1961
2039
|
});
|
|
1962
2040
|
}
|
|
1963
2041
|
};
|
|
1964
2042
|
|
|
1965
2043
|
// src/api/roleConnections.ts
|
|
1966
|
-
var
|
|
2044
|
+
var import_v109 = require("discord-api-types/v10");
|
|
1967
2045
|
var RoleConnectionsAPI = class {
|
|
1968
2046
|
constructor(rest) {
|
|
1969
2047
|
this.rest = rest;
|
|
@@ -1979,7 +2057,7 @@ var RoleConnectionsAPI = class {
|
|
|
1979
2057
|
* @param options - The options for fetching the role connection metadata records
|
|
1980
2058
|
*/
|
|
1981
2059
|
async getMetadataRecords(applicationId, { signal } = {}) {
|
|
1982
|
-
return this.rest.get(
|
|
2060
|
+
return this.rest.get(import_v109.Routes.applicationRoleConnectionMetadata(applicationId), {
|
|
1983
2061
|
signal
|
|
1984
2062
|
});
|
|
1985
2063
|
}
|
|
@@ -1992,7 +2070,7 @@ var RoleConnectionsAPI = class {
|
|
|
1992
2070
|
* @param options - The options for updating the role connection metadata records
|
|
1993
2071
|
*/
|
|
1994
2072
|
async updateMetadataRecords(applicationId, body, { signal } = {}) {
|
|
1995
|
-
return this.rest.put(
|
|
2073
|
+
return this.rest.put(import_v109.Routes.applicationRoleConnectionMetadata(applicationId), {
|
|
1996
2074
|
body,
|
|
1997
2075
|
signal
|
|
1998
2076
|
});
|
|
@@ -2000,7 +2078,7 @@ var RoleConnectionsAPI = class {
|
|
|
2000
2078
|
};
|
|
2001
2079
|
|
|
2002
2080
|
// src/api/stageInstances.ts
|
|
2003
|
-
var
|
|
2081
|
+
var import_v1010 = require("discord-api-types/v10");
|
|
2004
2082
|
var StageInstancesAPI = class {
|
|
2005
2083
|
constructor(rest) {
|
|
2006
2084
|
this.rest = rest;
|
|
@@ -2016,7 +2094,7 @@ var StageInstancesAPI = class {
|
|
|
2016
2094
|
* @param options - The options for creating the new stage instance
|
|
2017
2095
|
*/
|
|
2018
2096
|
async create(body, { reason, signal } = {}) {
|
|
2019
|
-
return this.rest.post(
|
|
2097
|
+
return this.rest.post(import_v1010.Routes.stageInstances(), {
|
|
2020
2098
|
body,
|
|
2021
2099
|
reason,
|
|
2022
2100
|
signal
|
|
@@ -2030,7 +2108,7 @@ var StageInstancesAPI = class {
|
|
|
2030
2108
|
* @param options - The options for fetching the stage instance
|
|
2031
2109
|
*/
|
|
2032
2110
|
async get(channelId, { signal } = {}) {
|
|
2033
|
-
return this.rest.get(
|
|
2111
|
+
return this.rest.get(import_v1010.Routes.stageInstance(channelId), { signal });
|
|
2034
2112
|
}
|
|
2035
2113
|
/**
|
|
2036
2114
|
* Edits a stage instance
|
|
@@ -2041,7 +2119,7 @@ var StageInstancesAPI = class {
|
|
|
2041
2119
|
* @param options - The options for editing the stage instance
|
|
2042
2120
|
*/
|
|
2043
2121
|
async edit(channelId, body, { reason, signal } = {}) {
|
|
2044
|
-
return this.rest.patch(
|
|
2122
|
+
return this.rest.patch(import_v1010.Routes.stageInstance(channelId), {
|
|
2045
2123
|
body,
|
|
2046
2124
|
reason,
|
|
2047
2125
|
signal
|
|
@@ -2055,12 +2133,12 @@ var StageInstancesAPI = class {
|
|
|
2055
2133
|
* @param options - The options for deleting the stage instance
|
|
2056
2134
|
*/
|
|
2057
2135
|
async delete(channelId, { reason, signal } = {}) {
|
|
2058
|
-
await this.rest.delete(
|
|
2136
|
+
await this.rest.delete(import_v1010.Routes.stageInstance(channelId), { reason, signal });
|
|
2059
2137
|
}
|
|
2060
2138
|
};
|
|
2061
2139
|
|
|
2062
2140
|
// src/api/sticker.ts
|
|
2063
|
-
var
|
|
2141
|
+
var import_v1011 = require("discord-api-types/v10");
|
|
2064
2142
|
var StickersAPI = class {
|
|
2065
2143
|
constructor(rest) {
|
|
2066
2144
|
this.rest = rest;
|
|
@@ -2075,7 +2153,7 @@ var StickersAPI = class {
|
|
|
2075
2153
|
* @param options - The options for fetching the sticker packs
|
|
2076
2154
|
*/
|
|
2077
2155
|
async getStickers({ signal } = {}) {
|
|
2078
|
-
return this.rest.get(
|
|
2156
|
+
return this.rest.get(import_v1011.Routes.stickerPacks(), { signal });
|
|
2079
2157
|
}
|
|
2080
2158
|
/**
|
|
2081
2159
|
* Fetches all of the sticker packs
|
|
@@ -2095,12 +2173,12 @@ var StickersAPI = class {
|
|
|
2095
2173
|
* @param options - The options for fetching the sticker
|
|
2096
2174
|
*/
|
|
2097
2175
|
async get(stickerId, { signal } = {}) {
|
|
2098
|
-
return this.rest.get(
|
|
2176
|
+
return this.rest.get(import_v1011.Routes.sticker(stickerId), { signal });
|
|
2099
2177
|
}
|
|
2100
2178
|
};
|
|
2101
2179
|
|
|
2102
2180
|
// src/api/thread.ts
|
|
2103
|
-
var
|
|
2181
|
+
var import_v1012 = require("discord-api-types/v10");
|
|
2104
2182
|
var ThreadsAPI = class {
|
|
2105
2183
|
constructor(rest) {
|
|
2106
2184
|
this.rest = rest;
|
|
@@ -2116,7 +2194,7 @@ var ThreadsAPI = class {
|
|
|
2116
2194
|
* @param options - The options for joining the thread
|
|
2117
2195
|
*/
|
|
2118
2196
|
async join(threadId, { signal } = {}) {
|
|
2119
|
-
await this.rest.put(
|
|
2197
|
+
await this.rest.put(import_v1012.Routes.threadMembers(threadId, "@me"), { signal });
|
|
2120
2198
|
}
|
|
2121
2199
|
/**
|
|
2122
2200
|
* Adds a member to a thread
|
|
@@ -2127,7 +2205,7 @@ var ThreadsAPI = class {
|
|
|
2127
2205
|
* @param options - The options for adding the member to the thread
|
|
2128
2206
|
*/
|
|
2129
2207
|
async addMember(threadId, userId, { signal } = {}) {
|
|
2130
|
-
await this.rest.put(
|
|
2208
|
+
await this.rest.put(import_v1012.Routes.threadMembers(threadId, userId), { signal });
|
|
2131
2209
|
}
|
|
2132
2210
|
/**
|
|
2133
2211
|
* Removes the current user from a thread
|
|
@@ -2137,7 +2215,7 @@ var ThreadsAPI = class {
|
|
|
2137
2215
|
* @param options - The options for leaving the thread
|
|
2138
2216
|
*/
|
|
2139
2217
|
async leave(threadId, { signal } = {}) {
|
|
2140
|
-
await this.rest.delete(
|
|
2218
|
+
await this.rest.delete(import_v1012.Routes.threadMembers(threadId, "@me"), { signal });
|
|
2141
2219
|
}
|
|
2142
2220
|
/**
|
|
2143
2221
|
* Removes a member from a thread
|
|
@@ -2148,7 +2226,7 @@ var ThreadsAPI = class {
|
|
|
2148
2226
|
* @param options - The options for removing the member from the thread
|
|
2149
2227
|
*/
|
|
2150
2228
|
async removeMember(threadId, userId, { signal } = {}) {
|
|
2151
|
-
await this.rest.delete(
|
|
2229
|
+
await this.rest.delete(import_v1012.Routes.threadMembers(threadId, userId), { signal });
|
|
2152
2230
|
}
|
|
2153
2231
|
/**
|
|
2154
2232
|
* Fetches a member of a thread
|
|
@@ -2159,7 +2237,7 @@ var ThreadsAPI = class {
|
|
|
2159
2237
|
* @param options - The options for fetching the member
|
|
2160
2238
|
*/
|
|
2161
2239
|
async getMember(threadId, userId, { signal } = {}) {
|
|
2162
|
-
return this.rest.get(
|
|
2240
|
+
return this.rest.get(import_v1012.Routes.threadMembers(threadId, userId), { signal });
|
|
2163
2241
|
}
|
|
2164
2242
|
/**
|
|
2165
2243
|
* Fetches all members of a thread
|
|
@@ -2169,13 +2247,13 @@ var ThreadsAPI = class {
|
|
|
2169
2247
|
* @param options - The options for fetching the members
|
|
2170
2248
|
*/
|
|
2171
2249
|
async getAllMembers(threadId, { signal } = {}) {
|
|
2172
|
-
return this.rest.get(
|
|
2250
|
+
return this.rest.get(import_v1012.Routes.threadMembers(threadId), { signal });
|
|
2173
2251
|
}
|
|
2174
2252
|
};
|
|
2175
2253
|
|
|
2176
2254
|
// src/api/user.ts
|
|
2177
|
-
var
|
|
2178
|
-
var
|
|
2255
|
+
var import_rest7 = require("@discordjs/rest");
|
|
2256
|
+
var import_v1013 = require("discord-api-types/v10");
|
|
2179
2257
|
var UsersAPI = class {
|
|
2180
2258
|
constructor(rest) {
|
|
2181
2259
|
this.rest = rest;
|
|
@@ -2191,7 +2269,7 @@ var UsersAPI = class {
|
|
|
2191
2269
|
* @param options - The options for fetching the user
|
|
2192
2270
|
*/
|
|
2193
2271
|
async get(userId, { signal } = {}) {
|
|
2194
|
-
return this.rest.get(
|
|
2272
|
+
return this.rest.get(import_v1013.Routes.user(userId), { signal });
|
|
2195
2273
|
}
|
|
2196
2274
|
/**
|
|
2197
2275
|
* Returns the user object of the requester's account
|
|
@@ -2200,7 +2278,7 @@ var UsersAPI = class {
|
|
|
2200
2278
|
* @param options - The options for fetching the current user
|
|
2201
2279
|
*/
|
|
2202
2280
|
async getCurrent({ signal } = {}) {
|
|
2203
|
-
return this.rest.get(
|
|
2281
|
+
return this.rest.get(import_v1013.Routes.user("@me"), { signal });
|
|
2204
2282
|
}
|
|
2205
2283
|
/**
|
|
2206
2284
|
* Returns a list of partial guild objects the current user is a member of
|
|
@@ -2210,8 +2288,8 @@ var UsersAPI = class {
|
|
|
2210
2288
|
* @param options - The options for fetching the guilds
|
|
2211
2289
|
*/
|
|
2212
2290
|
async getGuilds(query = {}, { signal } = {}) {
|
|
2213
|
-
return this.rest.get(
|
|
2214
|
-
query: (0,
|
|
2291
|
+
return this.rest.get(import_v1013.Routes.userGuilds(), {
|
|
2292
|
+
query: (0, import_rest7.makeURLSearchParams)(query),
|
|
2215
2293
|
signal
|
|
2216
2294
|
});
|
|
2217
2295
|
}
|
|
@@ -2223,7 +2301,7 @@ var UsersAPI = class {
|
|
|
2223
2301
|
* @param options - The options for leaving the guild
|
|
2224
2302
|
*/
|
|
2225
2303
|
async leaveGuild(guildId, { signal } = {}) {
|
|
2226
|
-
await this.rest.delete(
|
|
2304
|
+
await this.rest.delete(import_v1013.Routes.userGuild(guildId), { signal });
|
|
2227
2305
|
}
|
|
2228
2306
|
/**
|
|
2229
2307
|
* Edits the current user
|
|
@@ -2233,7 +2311,7 @@ var UsersAPI = class {
|
|
|
2233
2311
|
* @param options - The options for editing the user
|
|
2234
2312
|
*/
|
|
2235
2313
|
async edit(body, { signal } = {}) {
|
|
2236
|
-
return this.rest.patch(
|
|
2314
|
+
return this.rest.patch(import_v1013.Routes.user("@me"), { body, signal });
|
|
2237
2315
|
}
|
|
2238
2316
|
/**
|
|
2239
2317
|
* Fetches the guild member for the current user
|
|
@@ -2243,7 +2321,7 @@ var UsersAPI = class {
|
|
|
2243
2321
|
* @param options - The options for fetching the guild member
|
|
2244
2322
|
*/
|
|
2245
2323
|
async getGuildMember(guildId, { signal } = {}) {
|
|
2246
|
-
return this.rest.get(
|
|
2324
|
+
return this.rest.get(import_v1013.Routes.userGuildMember(guildId), { signal });
|
|
2247
2325
|
}
|
|
2248
2326
|
/**
|
|
2249
2327
|
* Edits the guild member for the current user
|
|
@@ -2254,7 +2332,7 @@ var UsersAPI = class {
|
|
|
2254
2332
|
* @param options - The options for editing the guild member
|
|
2255
2333
|
*/
|
|
2256
2334
|
async editCurrentGuildMember(guildId, body = {}, { reason, signal } = {}) {
|
|
2257
|
-
return this.rest.patch(
|
|
2335
|
+
return this.rest.patch(import_v1013.Routes.guildMember(guildId, "@me"), {
|
|
2258
2336
|
reason,
|
|
2259
2337
|
body,
|
|
2260
2338
|
signal
|
|
@@ -2268,7 +2346,7 @@ var UsersAPI = class {
|
|
|
2268
2346
|
* @param options - The options for opening the DM
|
|
2269
2347
|
*/
|
|
2270
2348
|
async createDM(userId, { signal } = {}) {
|
|
2271
|
-
return this.rest.post(
|
|
2349
|
+
return this.rest.post(import_v1013.Routes.userChannels(), {
|
|
2272
2350
|
body: { recipient_id: userId },
|
|
2273
2351
|
signal
|
|
2274
2352
|
});
|
|
@@ -2280,7 +2358,7 @@ var UsersAPI = class {
|
|
|
2280
2358
|
* @param options - The options for fetching the user's connections
|
|
2281
2359
|
*/
|
|
2282
2360
|
async getConnections({ signal } = {}) {
|
|
2283
|
-
return this.rest.get(
|
|
2361
|
+
return this.rest.get(import_v1013.Routes.userConnections(), { signal });
|
|
2284
2362
|
}
|
|
2285
2363
|
/**
|
|
2286
2364
|
* Gets the current user's active application role connection
|
|
@@ -2290,7 +2368,7 @@ var UsersAPI = class {
|
|
|
2290
2368
|
* @param options - The options for fetching the role connections
|
|
2291
2369
|
*/
|
|
2292
2370
|
async getApplicationRoleConnection(applicationId, { signal } = {}) {
|
|
2293
|
-
return this.rest.get(
|
|
2371
|
+
return this.rest.get(import_v1013.Routes.userApplicationRoleConnection(applicationId), {
|
|
2294
2372
|
signal
|
|
2295
2373
|
});
|
|
2296
2374
|
}
|
|
@@ -2303,7 +2381,7 @@ var UsersAPI = class {
|
|
|
2303
2381
|
* @param options - The options for updating the application role connection
|
|
2304
2382
|
*/
|
|
2305
2383
|
async updateApplicationRoleConnection(applicationId, body, { signal } = {}) {
|
|
2306
|
-
return this.rest.put(
|
|
2384
|
+
return this.rest.put(import_v1013.Routes.userApplicationRoleConnection(applicationId), {
|
|
2307
2385
|
body,
|
|
2308
2386
|
signal
|
|
2309
2387
|
});
|
|
@@ -2311,7 +2389,7 @@ var UsersAPI = class {
|
|
|
2311
2389
|
};
|
|
2312
2390
|
|
|
2313
2391
|
// src/api/voice.ts
|
|
2314
|
-
var
|
|
2392
|
+
var import_v1014 = require("discord-api-types/v10");
|
|
2315
2393
|
var VoiceAPI = class {
|
|
2316
2394
|
constructor(rest) {
|
|
2317
2395
|
this.rest = rest;
|
|
@@ -2326,13 +2404,13 @@ var VoiceAPI = class {
|
|
|
2326
2404
|
* @param options - The options for fetching the voice regions
|
|
2327
2405
|
*/
|
|
2328
2406
|
async getVoiceRegions({ signal } = {}) {
|
|
2329
|
-
return this.rest.get(
|
|
2407
|
+
return this.rest.get(import_v1014.Routes.voiceRegions(), { signal });
|
|
2330
2408
|
}
|
|
2331
2409
|
};
|
|
2332
2410
|
|
|
2333
2411
|
// src/api/webhook.ts
|
|
2334
|
-
var
|
|
2335
|
-
var
|
|
2412
|
+
var import_rest8 = require("@discordjs/rest");
|
|
2413
|
+
var import_v1015 = require("discord-api-types/v10");
|
|
2336
2414
|
var WebhooksAPI = class {
|
|
2337
2415
|
constructor(rest) {
|
|
2338
2416
|
this.rest = rest;
|
|
@@ -2349,7 +2427,7 @@ var WebhooksAPI = class {
|
|
|
2349
2427
|
* @param options - The options for fetching the webhook
|
|
2350
2428
|
*/
|
|
2351
2429
|
async get(id, { token, signal } = {}) {
|
|
2352
|
-
return this.rest.get(
|
|
2430
|
+
return this.rest.get(import_v1015.Routes.webhook(id, token), {
|
|
2353
2431
|
signal,
|
|
2354
2432
|
auth: !token
|
|
2355
2433
|
});
|
|
@@ -2364,7 +2442,7 @@ var WebhooksAPI = class {
|
|
|
2364
2442
|
* @param options - The options for editing the webhook
|
|
2365
2443
|
*/
|
|
2366
2444
|
async edit(id, body, { token, reason, signal } = {}) {
|
|
2367
|
-
return this.rest.patch(
|
|
2445
|
+
return this.rest.patch(import_v1015.Routes.webhook(id, token), {
|
|
2368
2446
|
reason,
|
|
2369
2447
|
body,
|
|
2370
2448
|
signal,
|
|
@@ -2380,7 +2458,7 @@ var WebhooksAPI = class {
|
|
|
2380
2458
|
* @param options - The options for deleting the webhook
|
|
2381
2459
|
*/
|
|
2382
2460
|
async delete(id, { token, reason, signal } = {}) {
|
|
2383
|
-
await this.rest.delete(
|
|
2461
|
+
await this.rest.delete(import_v1015.Routes.webhook(id, token), {
|
|
2384
2462
|
reason,
|
|
2385
2463
|
signal,
|
|
2386
2464
|
auth: !token
|
|
@@ -2401,8 +2479,8 @@ var WebhooksAPI = class {
|
|
|
2401
2479
|
files,
|
|
2402
2480
|
...body
|
|
2403
2481
|
}, { signal } = {}) {
|
|
2404
|
-
return this.rest.post(
|
|
2405
|
-
query: (0,
|
|
2482
|
+
return this.rest.post(import_v1015.Routes.webhook(id, token), {
|
|
2483
|
+
query: (0, import_rest8.makeURLSearchParams)({ wait, thread_id }),
|
|
2406
2484
|
files,
|
|
2407
2485
|
body,
|
|
2408
2486
|
auth: false,
|
|
@@ -2421,8 +2499,8 @@ var WebhooksAPI = class {
|
|
|
2421
2499
|
* @param options - The options for executing the webhook
|
|
2422
2500
|
*/
|
|
2423
2501
|
async executeSlack(id, token, body, query = {}, { signal } = {}) {
|
|
2424
|
-
await this.rest.post(
|
|
2425
|
-
query: (0,
|
|
2502
|
+
await this.rest.post(import_v1015.Routes.webhookPlatform(id, token, "slack"), {
|
|
2503
|
+
query: (0, import_rest8.makeURLSearchParams)(query),
|
|
2426
2504
|
body,
|
|
2427
2505
|
auth: false,
|
|
2428
2506
|
signal
|
|
@@ -2439,8 +2517,8 @@ var WebhooksAPI = class {
|
|
|
2439
2517
|
* @param options - The options for executing the webhook
|
|
2440
2518
|
*/
|
|
2441
2519
|
async executeGitHub(id, token, body, query = {}, { signal } = {}) {
|
|
2442
|
-
await this.rest.post(
|
|
2443
|
-
query: (0,
|
|
2520
|
+
await this.rest.post(import_v1015.Routes.webhookPlatform(id, token, "github"), {
|
|
2521
|
+
query: (0, import_rest8.makeURLSearchParams)(query),
|
|
2444
2522
|
body,
|
|
2445
2523
|
signal,
|
|
2446
2524
|
auth: false
|
|
@@ -2457,8 +2535,8 @@ var WebhooksAPI = class {
|
|
|
2457
2535
|
* @param options - The options for fetching the message
|
|
2458
2536
|
*/
|
|
2459
2537
|
async getMessage(id, token, messageId, query = {}, { signal } = {}) {
|
|
2460
|
-
return this.rest.get(
|
|
2461
|
-
query: (0,
|
|
2538
|
+
return this.rest.get(import_v1015.Routes.webhookMessage(id, token, messageId), {
|
|
2539
|
+
query: (0, import_rest8.makeURLSearchParams)(query),
|
|
2462
2540
|
auth: false,
|
|
2463
2541
|
signal
|
|
2464
2542
|
});
|
|
@@ -2478,8 +2556,8 @@ var WebhooksAPI = class {
|
|
|
2478
2556
|
files,
|
|
2479
2557
|
...body
|
|
2480
2558
|
}, { signal } = {}) {
|
|
2481
|
-
return this.rest.patch(
|
|
2482
|
-
query: (0,
|
|
2559
|
+
return this.rest.patch(import_v1015.Routes.webhookMessage(id, token, messageId), {
|
|
2560
|
+
query: (0, import_rest8.makeURLSearchParams)({ thread_id }),
|
|
2483
2561
|
auth: false,
|
|
2484
2562
|
body,
|
|
2485
2563
|
signal,
|
|
@@ -2497,8 +2575,8 @@ var WebhooksAPI = class {
|
|
|
2497
2575
|
* @param options - The options for deleting the message
|
|
2498
2576
|
*/
|
|
2499
2577
|
async deleteMessage(id, token, messageId, query = {}, { signal } = {}) {
|
|
2500
|
-
await this.rest.delete(
|
|
2501
|
-
query: (0,
|
|
2578
|
+
await this.rest.delete(import_v1015.Routes.webhookMessage(id, token, messageId), {
|
|
2579
|
+
query: (0, import_rest8.makeURLSearchParams)(query),
|
|
2502
2580
|
auth: false,
|
|
2503
2581
|
signal
|
|
2504
2582
|
});
|
|
@@ -2514,6 +2592,7 @@ var API = class {
|
|
|
2514
2592
|
this.channels = new ChannelsAPI(rest);
|
|
2515
2593
|
this.guilds = new GuildsAPI(rest);
|
|
2516
2594
|
this.invites = new InvitesAPI(rest);
|
|
2595
|
+
this.monetization = new MonetizationAPI(rest);
|
|
2517
2596
|
this.roleConnections = new RoleConnectionsAPI(rest);
|
|
2518
2597
|
this.oauth2 = new OAuth2API(rest);
|
|
2519
2598
|
this.stageInstances = new StageInstancesAPI(rest);
|
|
@@ -2533,6 +2612,7 @@ var API = class {
|
|
|
2533
2612
|
guilds;
|
|
2534
2613
|
interactions;
|
|
2535
2614
|
invites;
|
|
2615
|
+
monetization;
|
|
2536
2616
|
oauth2;
|
|
2537
2617
|
roleConnections;
|
|
2538
2618
|
stageInstances;
|
|
@@ -2549,7 +2629,7 @@ var import_util = require("@discordjs/util");
|
|
|
2549
2629
|
var import_ws = require("@discordjs/ws");
|
|
2550
2630
|
var import_snowflake = require("@sapphire/snowflake");
|
|
2551
2631
|
var import_async_event_emitter = require("@vladfrangu/async_event_emitter");
|
|
2552
|
-
var
|
|
2632
|
+
var import_v1016 = require("discord-api-types/v10");
|
|
2553
2633
|
var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
2554
2634
|
static {
|
|
2555
2635
|
__name(this, "Client");
|
|
@@ -2564,9 +2644,8 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
2564
2644
|
this.api = new API(rest);
|
|
2565
2645
|
this.gateway.on(import_ws.WebSocketShardEvents.Dispatch, ({ data: dispatch, shardId }) => {
|
|
2566
2646
|
this.emit(
|
|
2567
|
-
// TODO: move this expect-error down to the next line once entitlements get merged, so missing dispatch types result in errors
|
|
2568
|
-
// @ts-expect-error event props can't be resolved properly, but they are correct
|
|
2569
2647
|
dispatch.t,
|
|
2648
|
+
// @ts-expect-error event props can't be resolved properly, but they are correct
|
|
2570
2649
|
this.wrapIntrinsicProps(dispatch.d, shardId)
|
|
2571
2650
|
);
|
|
2572
2651
|
});
|
|
@@ -2594,7 +2673,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
2594
2673
|
}, timeout), "createTimer");
|
|
2595
2674
|
let timer = createTimer();
|
|
2596
2675
|
await this.gateway.send(shardId, {
|
|
2597
|
-
op:
|
|
2676
|
+
op: import_v1016.GatewayOpcodes.RequestGuildMembers,
|
|
2598
2677
|
// eslint-disable-next-line id-length
|
|
2599
2678
|
d: {
|
|
2600
2679
|
...options,
|
|
@@ -2602,7 +2681,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
2602
2681
|
}
|
|
2603
2682
|
});
|
|
2604
2683
|
try {
|
|
2605
|
-
const iterator = import_async_event_emitter.AsyncEventEmitter.on(this,
|
|
2684
|
+
const iterator = import_async_event_emitter.AsyncEventEmitter.on(this, import_v1016.GatewayDispatchEvents.GuildMembersChunk, { signal: controller.signal });
|
|
2606
2685
|
for await (const [{ data }] of iterator) {
|
|
2607
2686
|
if (data.nonce !== nonce)
|
|
2608
2687
|
continue;
|
|
@@ -2668,7 +2747,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
2668
2747
|
async updateVoiceState(options) {
|
|
2669
2748
|
const shardId = (0, import_util.calculateShardId)(options.guild_id, await this.gateway.getShardCount());
|
|
2670
2749
|
await this.gateway.send(shardId, {
|
|
2671
|
-
op:
|
|
2750
|
+
op: import_v1016.GatewayOpcodes.VoiceStateUpdate,
|
|
2672
2751
|
// eslint-disable-next-line id-length
|
|
2673
2752
|
d: options
|
|
2674
2753
|
});
|
|
@@ -2681,7 +2760,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
2681
2760
|
*/
|
|
2682
2761
|
async updatePresence(shardId, options) {
|
|
2683
2762
|
await this.gateway.send(shardId, {
|
|
2684
|
-
op:
|
|
2763
|
+
op: import_v1016.GatewayOpcodes.PresenceUpdate,
|
|
2685
2764
|
// eslint-disable-next-line id-length
|
|
2686
2765
|
d: options
|
|
2687
2766
|
});
|
|
@@ -2714,7 +2793,7 @@ __name(withFiles, "withFiles");
|
|
|
2714
2793
|
|
|
2715
2794
|
// src/index.ts
|
|
2716
2795
|
__reExport(src_exports, require("discord-api-types/v10"), module.exports);
|
|
2717
|
-
var version = "1.
|
|
2796
|
+
var version = "1.2.0-dev.1703462992-0f1e02b3d";
|
|
2718
2797
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2719
2798
|
0 && (module.exports = {
|
|
2720
2799
|
API,
|
|
@@ -2725,6 +2804,7 @@ var version = "1.1.2-dev.1703117367-891a67ac4";
|
|
|
2725
2804
|
GuildsAPI,
|
|
2726
2805
|
InteractionsAPI,
|
|
2727
2806
|
InvitesAPI,
|
|
2807
|
+
MonetizationAPI,
|
|
2728
2808
|
OAuth2API,
|
|
2729
2809
|
RoleConnectionsAPI,
|
|
2730
2810
|
StageInstancesAPI,
|