disgroove 2.2.1-dev.d0eed5e → 2.2.1

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.
Files changed (48) hide show
  1. package/README.md +3 -1
  2. package/dist/lib/Client.d.ts +222 -220
  3. package/dist/lib/Client.js +412 -415
  4. package/dist/lib/constants.d.ts +4 -4
  5. package/dist/lib/constants.js +4 -4
  6. package/dist/lib/gateway/Shard.d.ts +4 -2
  7. package/dist/lib/gateway/Shard.js +94 -74
  8. package/dist/lib/gateway/ShardManager.d.ts +6 -1
  9. package/dist/lib/gateway/ShardManager.js +6 -0
  10. package/dist/lib/index.d.ts +1 -0
  11. package/dist/lib/index.js +1 -0
  12. package/dist/lib/rest/CDN.d.ts +20 -20
  13. package/dist/lib/rest/CDN.js +20 -20
  14. package/dist/lib/rest/Endpoints.d.ts +81 -81
  15. package/dist/lib/rest/Endpoints.js +91 -91
  16. package/dist/lib/types/application-command.d.ts +4 -4
  17. package/dist/lib/types/application.d.ts +2 -2
  18. package/dist/lib/types/audit-log.d.ts +5 -5
  19. package/dist/lib/types/auto-moderation.d.ts +3 -3
  20. package/dist/lib/types/channel.d.ts +23 -21
  21. package/dist/lib/types/entitlements.d.ts +6 -6
  22. package/dist/lib/types/gateway-events.d.ts +83 -70
  23. package/dist/lib/types/guild-scheduled-event.d.ts +5 -5
  24. package/dist/lib/types/guild-template.d.ts +2 -2
  25. package/dist/lib/types/guild.d.ts +17 -17
  26. package/dist/lib/types/interaction.d.ts +8 -8
  27. package/dist/lib/types/message-components.d.ts +4 -4
  28. package/dist/lib/types/poll.d.ts +1 -1
  29. package/dist/lib/types/role.d.ts +3 -3
  30. package/dist/lib/types/sku.d.ts +2 -2
  31. package/dist/lib/types/stage-instance.d.ts +3 -3
  32. package/dist/lib/types/sticker.d.ts +5 -5
  33. package/dist/lib/types/team.d.ts +2 -2
  34. package/dist/lib/types/user.d.ts +1 -1
  35. package/dist/lib/types/voice-connections.d.ts +64 -0
  36. package/dist/lib/types/voice-connections.js +2 -0
  37. package/dist/lib/types/voice.d.ts +4 -4
  38. package/dist/lib/types/webhook.d.ts +3 -3
  39. package/dist/lib/utils/Util.d.ts +2 -2
  40. package/dist/lib/utils/Util.js +195 -193
  41. package/dist/lib/voice/VoiceConnection.d.ts +57 -0
  42. package/dist/lib/voice/VoiceConnection.js +150 -0
  43. package/dist/lib/voice/VoiceConnectionManager.d.ts +19 -0
  44. package/dist/lib/voice/VoiceConnectionManager.js +66 -0
  45. package/dist/lib/voice/index.d.ts +2 -0
  46. package/dist/lib/voice/index.js +18 -0
  47. package/dist/package.json +3 -3
  48. package/package.json +3 -3
@@ -1013,8 +1013,8 @@ export declare enum JSONErrorCodes {
1013
1013
  FailedToCreateStageNeededForStageEvent = 180002,
1014
1014
  MessageWasBlockedByAutomaticModeration = 200000,
1015
1015
  TitleWasBlockedByAutomaticModeration = 200001,
1016
- WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId = 220001,
1017
- WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId = 220002,
1016
+ WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadID = 220001,
1017
+ WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadID = 220002,
1018
1018
  WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
1019
1019
  WebhookServicesCannotBeUsedInForumChannels = 220004,
1020
1020
  MessageBlockedByHarmfulLinksFilter = 240000,
@@ -1038,7 +1038,7 @@ export declare enum RPCErrorCodes {
1038
1038
  InvalidEvent = 4004,
1039
1039
  InvalidChannel = 4005,
1040
1040
  InvalidPermissions = 4006,
1041
- InvalidClientId = 4007,
1041
+ InvalidClientID = 4007,
1042
1042
  InvalidOrigin = 4008,
1043
1043
  InvalidToken = 4009,
1044
1044
  InvalidUser = 4010,
@@ -1050,7 +1050,7 @@ export declare enum RPCErrorCodes {
1050
1050
  }
1051
1051
  /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes */
1052
1052
  export declare enum RPCCloseEventCodes {
1053
- InvalidClientId = 4000,
1053
+ InvalidClientID = 4000,
1054
1054
  InvalidOrigin = 4001,
1055
1055
  RateLimited = 4002,
1056
1056
  TokenRevoked = 4003,
@@ -1088,8 +1088,8 @@ var JSONErrorCodes;
1088
1088
  JSONErrorCodes[JSONErrorCodes["FailedToCreateStageNeededForStageEvent"] = 180002] = "FailedToCreateStageNeededForStageEvent";
1089
1089
  JSONErrorCodes[JSONErrorCodes["MessageWasBlockedByAutomaticModeration"] = 200000] = "MessageWasBlockedByAutomaticModeration";
1090
1090
  JSONErrorCodes[JSONErrorCodes["TitleWasBlockedByAutomaticModeration"] = 200001] = "TitleWasBlockedByAutomaticModeration";
1091
- JSONErrorCodes[JSONErrorCodes["WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId"] = 220001] = "WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadId";
1092
- JSONErrorCodes[JSONErrorCodes["WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId"] = 220002] = "WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadId";
1091
+ JSONErrorCodes[JSONErrorCodes["WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadID"] = 220001] = "WebhooksPostedToForumChannelsMustHaveAThreadNameOrThreadID";
1092
+ JSONErrorCodes[JSONErrorCodes["WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadID"] = 220002] = "WebhooksPostedToForumChannelsCannotHaveBothAThreadNameAndThreadID";
1093
1093
  JSONErrorCodes[JSONErrorCodes["WebhooksCanOnlyCreateThreadsInForumChannels"] = 220003] = "WebhooksCanOnlyCreateThreadsInForumChannels";
1094
1094
  JSONErrorCodes[JSONErrorCodes["WebhookServicesCannotBeUsedInForumChannels"] = 220004] = "WebhookServicesCannotBeUsedInForumChannels";
1095
1095
  JSONErrorCodes[JSONErrorCodes["MessageBlockedByHarmfulLinksFilter"] = 240000] = "MessageBlockedByHarmfulLinksFilter";
@@ -1114,7 +1114,7 @@ var RPCErrorCodes;
1114
1114
  RPCErrorCodes[RPCErrorCodes["InvalidEvent"] = 4004] = "InvalidEvent";
1115
1115
  RPCErrorCodes[RPCErrorCodes["InvalidChannel"] = 4005] = "InvalidChannel";
1116
1116
  RPCErrorCodes[RPCErrorCodes["InvalidPermissions"] = 4006] = "InvalidPermissions";
1117
- RPCErrorCodes[RPCErrorCodes["InvalidClientId"] = 4007] = "InvalidClientId";
1117
+ RPCErrorCodes[RPCErrorCodes["InvalidClientID"] = 4007] = "InvalidClientID";
1118
1118
  RPCErrorCodes[RPCErrorCodes["InvalidOrigin"] = 4008] = "InvalidOrigin";
1119
1119
  RPCErrorCodes[RPCErrorCodes["InvalidToken"] = 4009] = "InvalidToken";
1120
1120
  RPCErrorCodes[RPCErrorCodes["InvalidUser"] = 4010] = "InvalidUser";
@@ -1127,7 +1127,7 @@ var RPCErrorCodes;
1127
1127
  /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes */
1128
1128
  var RPCCloseEventCodes;
1129
1129
  (function (RPCCloseEventCodes) {
1130
- RPCCloseEventCodes[RPCCloseEventCodes["InvalidClientId"] = 4000] = "InvalidClientId";
1130
+ RPCCloseEventCodes[RPCCloseEventCodes["InvalidClientID"] = 4000] = "InvalidClientID";
1131
1131
  RPCCloseEventCodes[RPCCloseEventCodes["InvalidOrigin"] = 4001] = "InvalidOrigin";
1132
1132
  RPCCloseEventCodes[RPCCloseEventCodes["RateLimited"] = 4002] = "RateLimited";
1133
1133
  RPCCloseEventCodes[RPCCloseEventCodes["TokenRevoked"] = 4003] = "TokenRevoked";
@@ -1,12 +1,12 @@
1
1
  import WebSocket from "ws";
2
2
  import { Client } from "../Client";
3
- import type { GatewayPresenceUpdate, Identify, RequestGuildMembers, Resume } from "../types/gateway-events";
3
+ import type { GatewayPresenceUpdate, GatewayVoiceStateUpdate, Identify, RequestGuildMembers, Resume } from "../types/gateway-events";
4
4
  export declare class Shard {
5
5
  id: number;
6
6
  private heartbeatInterval;
7
7
  client: Client;
8
8
  ws: WebSocket;
9
- sessionId: string;
9
+ sessionID: string;
10
10
  constructor(id: number, client: Client);
11
11
  /** https://discord.com/developers/docs/topics/gateway#connections */
12
12
  connect(): void;
@@ -27,4 +27,6 @@ export declare class Shard {
27
27
  resume(options: Resume): void;
28
28
  /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
29
29
  updatePresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
30
+ /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
31
+ updateVoiceState(options: GatewayVoiceStateUpdate): void;
30
32
  }
@@ -36,7 +36,7 @@ class Shard {
36
36
  heartbeatInterval;
37
37
  client;
38
38
  ws;
39
- sessionId;
39
+ sessionID;
40
40
  constructor(id, client) {
41
41
  this.id = id;
42
42
  this.client = client;
@@ -87,7 +87,7 @@ class Shard {
87
87
  switch (packet.t) {
88
88
  case "READY":
89
89
  {
90
- this.sessionId = packet.d.session_id;
90
+ this.sessionID = packet.d.session_id;
91
91
  this.client.user = this.client.util.userFromRaw(packet.d.user);
92
92
  this.client.application = packet.d.application;
93
93
  this.client.emit(constants_1.GatewayEvents.Ready);
@@ -110,21 +110,21 @@ class Shard {
110
110
  break;
111
111
  case "AUTO_MODERATION_ACTION_EXECUTION":
112
112
  this.client.emit(constants_1.GatewayEvents.AutoModerationActionExecution, {
113
- guildId: packet.d.guild_id,
113
+ guildID: packet.d.guild_id,
114
114
  action: {
115
115
  type: packet.d.action.type,
116
116
  metadata: {
117
- channelId: packet.d.action.metadata.channel_id,
117
+ channelID: packet.d.action.metadata.channel_id,
118
118
  durationSeconds: packet.d.action.metadata.duration_seconds,
119
119
  customMessage: packet.d.action.metadata.custom_message,
120
120
  },
121
121
  },
122
- ruleId: packet.d.rule_id,
122
+ ruleID: packet.d.rule_id,
123
123
  ruleTriggerType: packet.d.rule_trigger_type,
124
- userId: packet.d.user_id,
125
- channelId: packet.d.channel_id,
126
- messageId: packet.d.message_id,
127
- alertSystemMessageId: packet.d.alert_system_message_id,
124
+ userID: packet.d.user_id,
125
+ channelID: packet.d.channel_id,
126
+ messageID: packet.d.message_id,
127
+ alertSystemMessageID: packet.d.alert_system_message_id,
128
128
  content: packet.d.content,
129
129
  matchedKeyword: packet.d.matched_keyword,
130
130
  matchedContent: packet.d.matched_content,
@@ -141,8 +141,8 @@ class Shard {
141
141
  break;
142
142
  case "CHANNEL_PINS_UPDATE":
143
143
  this.client.emit(constants_1.GatewayEvents.ChannelPinsUpdate, {
144
- guildId: packet.d.guild_id,
145
- channelId: packet.d.channel_id,
144
+ guildID: packet.d.guild_id,
145
+ channelID: packet.d.channel_id,
146
146
  lastPinTimestamp: packet.d.last_pin_timestamp,
147
147
  });
148
148
  break;
@@ -157,8 +157,8 @@ class Shard {
157
157
  break;
158
158
  case "THREAD_LIST_SYNC":
159
159
  this.client.emit(constants_1.GatewayEvents.ThreadListSync, {
160
- guildId: packet.d.guild_id,
161
- channelIds: packet.d.channel_ids,
160
+ guildID: packet.d.guild_id,
161
+ channelIDs: packet.d.channel_ids,
162
162
  threads: packet.d.threads.map((thread) => this.client.util.channelFromRaw(thread)),
163
163
  members: packet.d.members.map((threadMember) => this.client.util.threadMemberFromRaw(threadMember)),
164
164
  });
@@ -166,22 +166,22 @@ class Shard {
166
166
  case "THREAD_MEMBER_UPDATE":
167
167
  this.client.emit(constants_1.GatewayEvents.ThreadMemberUpdate, {
168
168
  id: packet.d.id,
169
- userId: packet.d.user_id,
169
+ userID: packet.d.user_id,
170
170
  joinTimestamp: packet.d.join_timestamp,
171
171
  flags: packet.d.flags,
172
172
  member: packet.d.member !== undefined
173
173
  ? this.client.util.guildMemberFromRaw(packet.d.member)
174
174
  : undefined,
175
- guildId: packet.d.guild_id,
175
+ guildID: packet.d.guild_id,
176
176
  });
177
177
  break;
178
178
  case "THREAD_MEMBERS_UPDATE":
179
179
  this.client.emit(constants_1.GatewayEvents.ThreadMembersUpdate, {
180
180
  id: packet.d.id,
181
- guildId: packet.d.guild_id,
181
+ guildID: packet.d.guild_id,
182
182
  memberCount: packet.d.member_count,
183
183
  addedMembers: packet.d.members.map((threadMember) => this.client.util.threadMemberFromRaw(threadMember)),
184
- removedMemberIds: packet.d.removed_member_ids,
184
+ removedMemberIDs: packet.d.removed_member_ids,
185
185
  });
186
186
  break;
187
187
  case "ENTITLEMENT_CREATE":
@@ -219,18 +219,18 @@ class Shard {
219
219
  case "GUILD_AUDIT_LOG_ENTRY_CREATE":
220
220
  this.client.emit(constants_1.GatewayEvents.GuildAuditLogEntryCreate, {
221
221
  ...this.client.util.auditLogEntryFromRaw(packet.d),
222
- guildId: packet.d.guild_id,
222
+ guildID: packet.d.guild_id,
223
223
  });
224
224
  break;
225
225
  case "GUILD_BAN_ADD":
226
226
  this.client.emit(constants_1.GatewayEvents.GuildBanAdd, {
227
- guildId: packet.d.guild_id,
227
+ guildID: packet.d.guild_id,
228
228
  user: this.client.util.userFromRaw(packet.d.user),
229
229
  });
230
230
  break;
231
231
  case "GUILD_BAN_REMOVE":
232
232
  this.client.emit(constants_1.GatewayEvents.GuildBanRemove, {
233
- guildId: packet.d.guild_id,
233
+ guildID: packet.d.guild_id,
234
234
  user: this.client.util.userFromRaw(packet.d.user),
235
235
  });
236
236
  break;
@@ -246,18 +246,18 @@ class Shard {
246
246
  case "GUILD_MEMBER_ADD":
247
247
  this.client.emit(constants_1.GatewayEvents.GuildMemberAdd, {
248
248
  ...this.client.util.guildMemberFromRaw(packet.d),
249
- guildId: packet.d.guild_id,
249
+ guildID: packet.d.guild_id,
250
250
  });
251
251
  break;
252
252
  case "GUILD_MEMBER_REMOVE":
253
253
  this.client.emit(constants_1.GatewayEvents.GuildMemberRemove, {
254
- guildId: packet.d.guild_id,
254
+ guildID: packet.d.guild_id,
255
255
  user: this.client.util.userFromRaw(packet.d.user),
256
256
  });
257
257
  break;
258
258
  case "GUILD_MEMBER_UPDATE":
259
259
  this.client.emit(constants_1.GatewayEvents.GuildMemberUpdate, {
260
- guildId: packet.d.guild_id,
260
+ guildID: packet.d.guild_id,
261
261
  roles: packet.d.roles,
262
262
  user: this.client.util.userFromRaw(packet.d.user),
263
263
  nick: packet.d.nick,
@@ -272,14 +272,14 @@ class Shard {
272
272
  avatarDecorationData: packet.d.avatar_decoration_data !== undefined
273
273
  ? {
274
274
  asset: packet.d.asset,
275
- skuId: packet.d.sku_id,
275
+ skuID: packet.d.sku_id,
276
276
  }
277
277
  : undefined,
278
278
  });
279
279
  break;
280
280
  case "GUILD_MEMBERS_CHUNK":
281
281
  this.client.emit(constants_1.GatewayEvents.GuildMembersChunk, {
282
- guildId: packet.d.guild_id,
282
+ guildID: packet.d.guild_id,
283
283
  members: packet.d.members.map((guildMember) => this.client.util.guildMemberFromRaw(guildMember)),
284
284
  chunkIndex: packet.d.chunk_index,
285
285
  chunkCount: packet.d.chunk_count,
@@ -315,20 +315,20 @@ class Shard {
315
315
  case "INTEGRATION_CREATE":
316
316
  this.client.emit(constants_1.GatewayEvents.IntegrationCreate, {
317
317
  ...this.client.util.integrationFromRaw(packet.d),
318
- guildId: packet.d.guild_id,
318
+ guildID: packet.d.guild_id,
319
319
  });
320
320
  break;
321
321
  case "INTEGRATION_UPDATE":
322
322
  this.client.emit(constants_1.GatewayEvents.IntegrationUpdate, {
323
323
  ...this.client.util.integrationFromRaw(packet.d),
324
- guildId: packet.d.guild_id,
324
+ guildID: packet.d.guild_id,
325
325
  });
326
326
  break;
327
327
  case "INTEGRATION_DELETE":
328
328
  this.client.emit(constants_1.GatewayEvents.IntegrationDelete, {
329
329
  id: packet.d.id,
330
- guildId: packet.d.guild_id,
331
- applicationId: packet.d.application_id,
330
+ guildID: packet.d.guild_id,
331
+ applicationID: packet.d.application_id,
332
332
  });
333
333
  break;
334
334
  case "INTERACTION_CREATE":
@@ -336,10 +336,10 @@ class Shard {
336
336
  break;
337
337
  case "INVITE_CREATE":
338
338
  this.client.emit(constants_1.GatewayEvents.InviteCreate, {
339
- channelId: packet.d.channel_id,
339
+ channelID: packet.d.channel_id,
340
340
  code: packet.d.code,
341
341
  createdAt: packet.d.created_at,
342
- guildId: packet.d.guild_id,
342
+ guildID: packet.d.guild_id,
343
343
  inviter: packet.d.inviter !== undefined
344
344
  ? this.client.util.userFromRaw(packet.d.inviter)
345
345
  : undefined,
@@ -358,15 +358,15 @@ class Shard {
358
358
  break;
359
359
  case "INVITE_DELETE":
360
360
  this.client.emit(constants_1.GatewayEvents.InviteDelete, {
361
- channelId: packet.d.channel_id,
362
- guildId: packet.d.guild_id,
361
+ channelID: packet.d.channel_id,
362
+ guildID: packet.d.guild_id,
363
363
  code: packet.d.code,
364
364
  });
365
365
  break;
366
366
  case "MESSAGE_CREATE":
367
367
  this.client.emit(constants_1.GatewayEvents.MessageCreate, {
368
368
  ...this.client.util.messageFromRaw(packet.d),
369
- guildId: packet.d.guild_id,
369
+ guildID: packet.d.guild_id,
370
370
  member: packet.d.member !== undefined
371
371
  ? this.client.util.guildMemberFromRaw(packet.d.member)
372
372
  : undefined,
@@ -379,28 +379,28 @@ class Shard {
379
379
  case "MESSAGE_DELETE":
380
380
  this.client.emit(constants_1.GatewayEvents.MessageDelete, {
381
381
  id: packet.d.id,
382
- channelId: packet.d.channel_id,
383
- guildId: packet.d.guild_id,
382
+ channelID: packet.d.channel_id,
383
+ guildID: packet.d.guild_id,
384
384
  });
385
385
  break;
386
386
  case "MESSAGE_DELETE_BULK":
387
387
  this.client.emit(constants_1.GatewayEvents.MessageDeleteBulk, {
388
388
  ids: packet.d.ids,
389
- channelId: packet.d.channel_id,
390
- guildId: packet.d.guild_id,
389
+ channelID: packet.d.channel_id,
390
+ guildID: packet.d.guild_id,
391
391
  });
392
392
  break;
393
393
  case "MESSAGE_REACTION_ADD":
394
394
  this.client.emit(constants_1.GatewayEvents.MessageReactionAdd, {
395
- userId: packet.d.user_id,
396
- channelId: packet.d.user_id,
397
- messageId: packet.d.user_id,
398
- guildId: packet.d.user_id,
395
+ userID: packet.d.user_id,
396
+ channelID: packet.d.user_id,
397
+ messageID: packet.d.user_id,
398
+ guildID: packet.d.user_id,
399
399
  member: packet.d.member !== undefined
400
400
  ? this.client.util.guildMemberFromRaw(packet.d.member)
401
401
  : undefined,
402
402
  emoji: this.client.util.emojiFromRaw(packet.d.emoji),
403
- messageAuthorId: packet.d.message_author_id,
403
+ messageAuthorID: packet.d.message_author_id,
404
404
  burst: packet.d.burst,
405
405
  burstColors: packet.d.burst_colors,
406
406
  type: packet.d.type,
@@ -408,10 +408,10 @@ class Shard {
408
408
  break;
409
409
  case "MESSAGE_REACTION_REMOVE":
410
410
  this.client.emit(constants_1.GatewayEvents.MessageReactionRemove, {
411
- userId: packet.d.user_id,
412
- channelId: packet.d.user_id,
413
- messageId: packet.d.user_id,
414
- guildId: packet.d.user_id,
411
+ userID: packet.d.user_id,
412
+ channelID: packet.d.user_id,
413
+ messageID: packet.d.user_id,
414
+ guildID: packet.d.user_id,
415
415
  emoji: this.client.util.emojiFromRaw(packet.d.emoji),
416
416
  burst: packet.d.burst,
417
417
  type: packet.d.type,
@@ -419,16 +419,16 @@ class Shard {
419
419
  break;
420
420
  case "MESSAGE_REACTION_REMOVE_ALL":
421
421
  this.client.emit(constants_1.GatewayEvents.MessageReactionRemoveAll, {
422
- channelId: packet.d.channel_id,
423
- messageId: packet.d.message_id,
424
- guildId: packet.d.guild_id,
422
+ channelID: packet.d.channel_id,
423
+ messageID: packet.d.message_id,
424
+ guildID: packet.d.guild_id,
425
425
  });
426
426
  break;
427
427
  case "MESSAGE_REACTION_REMOVE_EMOJI":
428
428
  this.client.emit(constants_1.GatewayEvents.MessageReactionRemoveEmoji, {
429
- channelId: packet.d.channel_id,
430
- guildId: packet.d.guild_id,
431
- messageId: packet.d.message_id,
429
+ channelID: packet.d.channel_id,
430
+ guildID: packet.d.guild_id,
431
+ messageID: packet.d.message_id,
432
432
  emoji: this.client.util.emojiFromRaw(packet.d.emoji),
433
433
  });
434
434
  break;
@@ -446,9 +446,9 @@ class Shard {
446
446
  break;
447
447
  case "TYPING_START":
448
448
  this.client.emit(constants_1.GatewayEvents.TypingStart, {
449
- channelId: packet.d.channel_id,
450
- guildId: packet.d.guild_id,
451
- userId: packet.d.user_id,
449
+ channelID: packet.d.channel_id,
450
+ guildID: packet.d.guild_id,
451
+ userID: packet.d.user_id,
452
452
  timestamp: packet.d.timestamp,
453
453
  member: packet.d.member !== undefined
454
454
  ? this.client.util.guildMemberFromRaw(packet.d.member)
@@ -462,31 +462,39 @@ class Shard {
462
462
  this.client.emit(constants_1.GatewayEvents.VoiceStateUpdate, this.client.util.voiceStateFromRaw(packet.d));
463
463
  break;
464
464
  case "VOICE_SERVER_UPDATE":
465
- this.client.emit(constants_1.GatewayEvents.VoiceServerUpdate, {
466
- token: packet.d.token,
467
- guildId: packet.d.guild_id,
468
- endpoint: packet.d.endpoint,
469
- });
465
+ {
466
+ this.client.voiceConnections.connect(packet.d.endpoint, {
467
+ serverID: packet.d.guild_id,
468
+ userID: this.client.user.id,
469
+ sessionID: this.sessionID,
470
+ token: packet.d.token,
471
+ });
472
+ this.client.emit(constants_1.GatewayEvents.VoiceServerUpdate, {
473
+ token: packet.d.token,
474
+ guildID: packet.d.guild_id,
475
+ endpoint: packet.d.endpoint,
476
+ });
477
+ }
470
478
  break;
471
479
  case "WEBHOOKS_UPDATE":
472
480
  this.client.emit(constants_1.GatewayEvents.WebhooksUpdate, packet.d.channel_id, packet.d.guild_id);
473
481
  break;
474
482
  case "MESSAGE_POLL_VOTE_ADD":
475
483
  this.client.emit(constants_1.GatewayEvents.MessagePollVoteAdd, {
476
- userId: packet.d.user_id,
477
- channelId: packet.d.channel_id,
478
- messageId: packet.d.message_id,
479
- guildId: packet.d.guild_id,
480
- answerId: packet.d.answer_id,
484
+ userID: packet.d.user_id,
485
+ channelID: packet.d.channel_id,
486
+ messageID: packet.d.message_id,
487
+ guildID: packet.d.guild_id,
488
+ answerID: packet.d.answer_id,
481
489
  });
482
490
  break;
483
491
  case "MESSAGE_POLL_VOTE_REMOVE":
484
492
  this.client.emit(constants_1.GatewayEvents.MessagePollVoteRemove, {
485
- userId: packet.d.user_id,
486
- channelId: packet.d.channel_id,
487
- messageId: packet.d.message_id,
488
- guildId: packet.d.guild_id,
489
- answerId: packet.d.answer_id,
493
+ userID: packet.d.user_id,
494
+ channelID: packet.d.channel_id,
495
+ messageID: packet.d.message_id,
496
+ guildID: packet.d.guild_id,
497
+ answerID: packet.d.answer_id,
490
498
  });
491
499
  break;
492
500
  }
@@ -536,11 +544,11 @@ class Shard {
536
544
  this.ws.send(JSON.stringify({
537
545
  op: constants_1.GatewayOPCodes.RequestGuildMembers,
538
546
  d: {
539
- guild_id: options.guildId,
547
+ guild_id: options.guildID,
540
548
  query: options.query,
541
549
  limit: options.limit,
542
550
  presences: options.presences,
543
- user_ids: options.userIds,
551
+ user_ids: options.userIDs,
544
552
  nonce: options.nonce,
545
553
  },
546
554
  }));
@@ -551,7 +559,7 @@ class Shard {
551
559
  op: constants_1.GatewayOPCodes.Resume,
552
560
  d: {
553
561
  token: options.token,
554
- session_id: options.sessionId,
562
+ session_id: options.sessionID,
555
563
  seq: options.seq,
556
564
  },
557
565
  }));
@@ -568,5 +576,17 @@ class Shard {
568
576
  },
569
577
  }));
570
578
  }
579
+ /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
580
+ updateVoiceState(options) {
581
+ this.ws.send(JSON.stringify({
582
+ op: constants_1.GatewayOPCodes.VoiceStateUpdate,
583
+ d: {
584
+ guild_id: options.guildID,
585
+ channel_id: options.channelID,
586
+ self_mute: options.selfMute,
587
+ self_deaf: options.selfDeaf,
588
+ },
589
+ }));
590
+ }
571
591
  }
572
592
  exports.Shard = Shard;
@@ -1,5 +1,10 @@
1
- import { Shard } from ".";
1
+ import type { Shard } from ".";
2
+ import type { GatewayPresenceUpdate } from "../types/gateway-events";
2
3
  export declare class ShardManager extends Map<number, Shard> {
4
+ /** https://discord.com/developers/docs/topics/gateway#connections */
3
5
  connect(): void;
6
+ /** https://discord.com/developers/docs/topics/gateway#connections */
4
7
  disconnect(): void;
8
+ /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
9
+ updatePresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
5
10
  }
@@ -2,11 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ShardManager = void 0;
4
4
  class ShardManager extends Map {
5
+ /** https://discord.com/developers/docs/topics/gateway#connections */
5
6
  connect() {
6
7
  this.forEach((shard) => shard.connect());
7
8
  }
9
+ /** https://discord.com/developers/docs/topics/gateway#connections */
8
10
  disconnect() {
9
11
  this.forEach((shard) => shard.disconnect());
10
12
  }
13
+ /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
14
+ updatePresence(options) {
15
+ this.forEach((shard) => shard.updatePresence(options));
16
+ }
11
17
  }
12
18
  exports.ShardManager = ShardManager;
@@ -26,5 +26,6 @@ export * from "./types/user";
26
26
  export * from "./types/voice";
27
27
  export * from "./types/webhook";
28
28
  export * from "./utils";
29
+ export * from "./voice";
29
30
  export * from "./Client";
30
31
  export * from "./constants";
package/dist/lib/index.js CHANGED
@@ -42,5 +42,6 @@ __exportStar(require("./types/user"), exports);
42
42
  __exportStar(require("./types/voice"), exports);
43
43
  __exportStar(require("./types/webhook"), exports);
44
44
  __exportStar(require("./utils"), exports);
45
+ __exportStar(require("./voice"), exports);
45
46
  __exportStar(require("./Client"), exports);
46
47
  __exportStar(require("./constants"), exports);
@@ -1,22 +1,22 @@
1
1
  import type { snowflake } from "../types/common";
2
- export declare const achievementIcon: (applicationId: snowflake, achievementId: snowflake, iconHash: string) => `https://cdn.discordapp.com/app-assets/${string}/achievements/${string}/icons/${string}.png`;
3
- export declare const applicationAsset: (applicationId: snowflake, assetId: snowflake) => `https://cdn.discordapp.com/app-assets/${string}/${string}.png`;
4
- export declare const applicationCover: (applicationId: snowflake, coverImage: string) => `https://cdn.discordapp.com/app-icons/${string}/${string}.png`;
5
- export declare const applicationIcon: (applicationId: snowflake, icon: string) => `https://cdn.discordapp.com/app-icons/${string}/${string}.png`;
6
- export declare const customEmoji: (emojiId: snowflake) => `https://cdn.discordapp.com/emojis/${string}.png`;
2
+ export declare const achievementIcon: (applicationID: snowflake, achievementID: snowflake, iconHash: string) => `https://cdn.discordapp.com/app-assets/${string}/achievements/${string}/icons/${string}.png`;
3
+ export declare const applicationAsset: (applicationID: snowflake, assetID: snowflake) => `https://cdn.discordapp.com/app-assets/${string}/${string}.png`;
4
+ export declare const applicationCover: (applicationID: snowflake, coverImage: string) => `https://cdn.discordapp.com/app-icons/${string}/${string}.png`;
5
+ export declare const applicationIcon: (applicationID: snowflake, icon: string) => `https://cdn.discordapp.com/app-icons/${string}/${string}.png`;
6
+ export declare const customEmoji: (emojiID: snowflake) => `https://cdn.discordapp.com/emojis/${string}.png`;
7
7
  export declare const defaultUserAvatar: (index: string) => `https://cdn.discordapp.com/embed/avatars/${string}.png`;
8
- export declare const guildBanner: (guildId: snowflake, banner: string) => `https://cdn.discordapp.com/banners/${string}/${string}.png`;
9
- export declare const guildDiscoverySplash: (guildId: snowflake, splash: string) => `https://cdn.discordapp.com/discovery-splashes/${string}/${string}.png`;
10
- export declare const guildIcon: (guildId: snowflake, icon: string) => `https://cdn.discordapp.com/icons/${string}/${string}.png`;
11
- export declare const guildMemberAvatar: (guildId: snowflake, userId: snowflake, avatar: string) => `https://cdn.discordapp.com/guilds/${string}/users/${string}/avatars/${string}.png`;
12
- export declare const guildMemberBanner: (guildId: snowflake, userId: snowflake, banner: string) => `https://cdn.discordapp.com/guilds/${string}/users/${string}/banners/${string}.png`;
13
- export declare const guildScheduledEventCover: (scheduledEventId: snowflake, coverImage: string) => `https://cdn.discordapp.com/guild-events/${string}/${string}.png`;
14
- export declare const guildSplash: (guildId: snowflake, splash: string) => `https://cdn.discordapp.com/splashes/${string}/${string}.png`;
15
- export declare const roleIcon: (roleId: snowflake, icon: string) => `https://cdn.discordapp.com/role-icons/${string}/${string}.png`;
16
- export declare const stickerPackBanner: (assetId: snowflake) => `https://cdn.discordapp.com/app-assets/710982414301790216/store/${string}.png`;
17
- export declare const sticker: (stickerId: snowflake) => `https://cdn.discordapp.com/stickers/${string}.png`;
18
- export declare const storePageAsset: (applicationId: snowflake, assetId: snowflake) => `https://cdn.discordapp.com/app-assets/${string}/store/${string}`;
19
- export declare const teamIcon: (teamId: snowflake, icon: string) => `https://cdn.discordapp.com/team-icons/${string}/${string}.png`;
20
- export declare const userAvatar: (userId: snowflake, avatar: string) => `https://cdn.discordapp.com/avatars/${string}/${string}.png`;
21
- export declare const userAvatarDecoration: (userId: snowflake, avatarDecoration: string) => `https://cdn.discordapp.com/avatar-decorations/${string}/${string}.png`;
22
- export declare const userBanner: (userId: snowflake, banner: string) => `https://cdn.discordapp.com/banners/${string}/${string}.png`;
8
+ export declare const guildBanner: (guildID: snowflake, banner: string) => `https://cdn.discordapp.com/banners/${string}/${string}.png`;
9
+ export declare const guildDiscoverySplash: (guildID: snowflake, splash: string) => `https://cdn.discordapp.com/discovery-splashes/${string}/${string}.png`;
10
+ export declare const guildIcon: (guildID: snowflake, icon: string) => `https://cdn.discordapp.com/icons/${string}/${string}.png`;
11
+ export declare const guildMemberAvatar: (guildID: snowflake, userID: snowflake, avatar: string) => `https://cdn.discordapp.com/guilds/${string}/users/${string}/avatars/${string}.png`;
12
+ export declare const guildMemberBanner: (guildID: snowflake, userID: snowflake, banner: string) => `https://cdn.discordapp.com/guilds/${string}/users/${string}/banners/${string}.png`;
13
+ export declare const guildScheduledEventCover: (scheduledEventID: snowflake, coverImage: string) => `https://cdn.discordapp.com/guild-events/${string}/${string}.png`;
14
+ export declare const guildSplash: (guildID: snowflake, splash: string) => `https://cdn.discordapp.com/splashes/${string}/${string}.png`;
15
+ export declare const roleIcon: (roleID: snowflake, icon: string) => `https://cdn.discordapp.com/role-icons/${string}/${string}.png`;
16
+ export declare const stickerPackBanner: (assetID: snowflake) => `https://cdn.discordapp.com/app-assets/710982414301790216/store/${string}.png`;
17
+ export declare const sticker: (stickerID: snowflake) => `https://cdn.discordapp.com/stickers/${string}.png`;
18
+ export declare const storePageAsset: (applicationID: snowflake, assetID: snowflake) => `https://cdn.discordapp.com/app-assets/${string}/store/${string}`;
19
+ export declare const teamIcon: (teamID: snowflake, icon: string) => `https://cdn.discordapp.com/team-icons/${string}/${string}.png`;
20
+ export declare const userAvatar: (userID: snowflake, avatar: string) => `https://cdn.discordapp.com/avatars/${string}/${string}.png`;
21
+ export declare const userAvatarDecoration: (userID: snowflake, avatarDecoration: string) => `https://cdn.discordapp.com/avatar-decorations/${string}/${string}.png`;
22
+ export declare const userBanner: (userID: snowflake, banner: string) => `https://cdn.discordapp.com/banners/${string}/${string}.png`;