@discordjs/core 0.5.2 → 0.5.3-dev.1681776604-f1fdd5b.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/http-only.js +1 -1
- package/dist/http-only.js.map +1 -1
- package/dist/http-only.mjs +1 -1
- package/dist/http-only.mjs.map +1 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2299,14 +2299,14 @@ import {
|
|
|
2299
2299
|
} from "discord-api-types/v10";
|
|
2300
2300
|
var Client = class extends AsyncEventEmitter {
|
|
2301
2301
|
rest;
|
|
2302
|
-
|
|
2302
|
+
gateway;
|
|
2303
2303
|
api;
|
|
2304
|
-
constructor({ rest,
|
|
2304
|
+
constructor({ rest, gateway }) {
|
|
2305
2305
|
super();
|
|
2306
2306
|
this.rest = rest;
|
|
2307
|
-
this.
|
|
2307
|
+
this.gateway = gateway;
|
|
2308
2308
|
this.api = new API(rest);
|
|
2309
|
-
this.
|
|
2309
|
+
this.gateway.on(WebSocketShardEvents.Dispatch, ({ data: dispatch, shardId }) => {
|
|
2310
2310
|
this.emit(dispatch.t, this.wrapIntrinsicProps(dispatch.d, shardId));
|
|
2311
2311
|
});
|
|
2312
2312
|
}
|
|
@@ -2318,7 +2318,7 @@ var Client = class extends AsyncEventEmitter {
|
|
|
2318
2318
|
* @param timeout - The timeout for waiting for each guild members chunk event
|
|
2319
2319
|
*/
|
|
2320
2320
|
async requestGuildMembers(options, timeout = 1e4) {
|
|
2321
|
-
const shardId = calculateShardId(options.guild_id, await this.
|
|
2321
|
+
const shardId = calculateShardId(options.guild_id, await this.gateway.getShardCount());
|
|
2322
2322
|
const nonce = options.nonce ?? DiscordSnowflake.generate().toString();
|
|
2323
2323
|
const promise = new Promise((resolve, reject) => {
|
|
2324
2324
|
const guildMembers = [];
|
|
@@ -2337,7 +2337,7 @@ var Client = class extends AsyncEventEmitter {
|
|
|
2337
2337
|
}, "handler");
|
|
2338
2338
|
this.on(GatewayDispatchEvents.GuildMembersChunk, handler);
|
|
2339
2339
|
});
|
|
2340
|
-
await this.
|
|
2340
|
+
await this.gateway.send(shardId, {
|
|
2341
2341
|
op: GatewayOpcodes.RequestGuildMembers,
|
|
2342
2342
|
// eslint-disable-next-line id-length
|
|
2343
2343
|
d: {
|
|
@@ -2354,8 +2354,8 @@ var Client = class extends AsyncEventEmitter {
|
|
|
2354
2354
|
* @param options - The options for updating the voice state
|
|
2355
2355
|
*/
|
|
2356
2356
|
async updateVoiceState(options) {
|
|
2357
|
-
const shardId = calculateShardId(options.guild_id, await this.
|
|
2358
|
-
await this.
|
|
2357
|
+
const shardId = calculateShardId(options.guild_id, await this.gateway.getShardCount());
|
|
2358
|
+
await this.gateway.send(shardId, {
|
|
2359
2359
|
op: GatewayOpcodes.VoiceStateUpdate,
|
|
2360
2360
|
// eslint-disable-next-line id-length
|
|
2361
2361
|
d: options
|
|
@@ -2368,7 +2368,7 @@ var Client = class extends AsyncEventEmitter {
|
|
|
2368
2368
|
* @param options - The options for updating the presence
|
|
2369
2369
|
*/
|
|
2370
2370
|
async updatePresence(shardId, options) {
|
|
2371
|
-
await this.
|
|
2371
|
+
await this.gateway.send(shardId, {
|
|
2372
2372
|
op: GatewayOpcodes.PresenceUpdate,
|
|
2373
2373
|
// eslint-disable-next-line id-length
|
|
2374
2374
|
d: options
|
|
@@ -2403,7 +2403,7 @@ __name(withFiles, "withFiles");
|
|
|
2403
2403
|
|
|
2404
2404
|
// src/index.ts
|
|
2405
2405
|
export * from "discord-api-types/v10";
|
|
2406
|
-
var version = "0.5.
|
|
2406
|
+
var version = "0.5.3-dev.1681776604-f1fdd5b.0";
|
|
2407
2407
|
export {
|
|
2408
2408
|
API,
|
|
2409
2409
|
ApplicationCommandsAPI,
|