disgroove 2.2.2-dev.4aafdf4 → 2.2.2-dev.90b732e

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 (83) hide show
  1. package/README.md +4 -2
  2. package/dist/lib/Client.d.ts +62 -54
  3. package/dist/lib/Client.js +186 -181
  4. package/dist/lib/constants.d.ts +83 -72
  5. package/dist/lib/constants.js +86 -73
  6. package/dist/lib/gateway/Shard.d.ts +1 -1
  7. package/dist/lib/gateway/Shard.js +198 -169
  8. package/dist/lib/index.d.ts +1 -0
  9. package/dist/lib/index.js +1 -0
  10. package/dist/lib/rest/Endpoints.d.ts +1 -1
  11. package/dist/lib/rest/Endpoints.js +3 -3
  12. package/dist/lib/rest/RequestManager.d.ts +1 -1
  13. package/dist/lib/rest/RequestManager.js +1 -1
  14. package/dist/lib/rest/index.d.ts +0 -1
  15. package/dist/lib/rest/index.js +1 -2
  16. package/dist/lib/transformers/Applications.d.ts +8 -0
  17. package/dist/lib/transformers/Applications.js +211 -0
  18. package/dist/lib/transformers/AuditLogs.d.ts +7 -0
  19. package/dist/lib/transformers/AuditLogs.js +97 -0
  20. package/dist/lib/transformers/AutoModeration.d.ts +5 -0
  21. package/dist/lib/transformers/AutoModeration.js +64 -0
  22. package/dist/lib/transformers/Channels.d.ts +16 -0
  23. package/dist/lib/transformers/Channels.js +676 -0
  24. package/dist/lib/transformers/Emojis.d.ts +5 -0
  25. package/dist/lib/transformers/Emojis.js +31 -0
  26. package/dist/lib/transformers/Entitlements.d.ts +7 -0
  27. package/dist/lib/transformers/Entitlements.js +58 -0
  28. package/dist/lib/transformers/GuildScheduledEvents.d.ts +5 -0
  29. package/dist/lib/transformers/GuildScheduledEvents.js +51 -0
  30. package/dist/lib/transformers/GuildTemplates.d.ts +5 -0
  31. package/dist/lib/transformers/GuildTemplates.js +38 -0
  32. package/dist/lib/transformers/Guilds.d.ts +12 -0
  33. package/dist/lib/transformers/Guilds.js +248 -0
  34. package/dist/lib/transformers/Interactions.d.ts +10 -0
  35. package/dist/lib/transformers/Interactions.js +273 -0
  36. package/dist/lib/transformers/Invites.d.ts +5 -0
  37. package/dist/lib/transformers/Invites.js +79 -0
  38. package/dist/lib/transformers/Polls.d.ts +5 -0
  39. package/dist/lib/transformers/Polls.js +50 -0
  40. package/dist/lib/transformers/Presences.d.ts +8 -0
  41. package/dist/lib/transformers/Presences.js +108 -0
  42. package/dist/lib/transformers/Roles.d.ts +5 -0
  43. package/dist/lib/transformers/Roles.js +56 -0
  44. package/dist/lib/transformers/SKUs.d.ts +5 -0
  45. package/dist/lib/transformers/SKUs.js +26 -0
  46. package/dist/lib/transformers/StageInstances.d.ts +5 -0
  47. package/dist/lib/transformers/StageInstances.js +28 -0
  48. package/dist/lib/transformers/Stickers.d.ts +5 -0
  49. package/dist/lib/transformers/Stickers.js +41 -0
  50. package/dist/lib/transformers/Teams.d.ts +5 -0
  51. package/dist/lib/transformers/Teams.js +35 -0
  52. package/dist/lib/transformers/Users.d.ts +5 -0
  53. package/dist/lib/transformers/Users.js +48 -0
  54. package/dist/lib/transformers/Voice.d.ts +5 -0
  55. package/dist/lib/transformers/Voice.js +45 -0
  56. package/dist/lib/transformers/Webhooks.d.ts +5 -0
  57. package/dist/lib/transformers/Webhooks.js +51 -0
  58. package/dist/lib/transformers/index.d.ts +21 -0
  59. package/dist/lib/transformers/index.js +37 -0
  60. package/dist/lib/types/entitlements.d.ts +0 -6
  61. package/dist/lib/types/gateway-events.d.ts +21 -8
  62. package/dist/lib/types/interaction.d.ts +1 -1
  63. package/dist/lib/types/sku.d.ts +0 -12
  64. package/dist/lib/utils/Util.d.ts +1 -91
  65. package/dist/lib/utils/Util.js +2 -2167
  66. package/dist/lib/utils/errors.d.ts +3 -3
  67. package/dist/lib/utils/errors.js +6 -8
  68. package/dist/lib/utils/formatters.d.ts +9 -0
  69. package/dist/lib/utils/formatters.js +38 -0
  70. package/dist/lib/utils/index.d.ts +2 -0
  71. package/dist/lib/utils/index.js +15 -0
  72. package/dist/package.json +1 -1
  73. package/package.json +1 -1
  74. package/dist/lib/types/voice-connections.d.ts +0 -64
  75. package/dist/lib/types/voice-connections.js +0 -2
  76. package/dist/lib/voice/VoiceConnection.d.ts +0 -57
  77. package/dist/lib/voice/VoiceConnection.js +0 -150
  78. package/dist/lib/voice/VoiceConnectionManager.d.ts +0 -19
  79. package/dist/lib/voice/VoiceConnectionManager.js +0 -66
  80. package/dist/lib/voice/index.d.ts +0 -2
  81. package/dist/lib/voice/index.js +0 -18
  82. /package/dist/lib/{rest → utils}/CDN.d.ts +0 -0
  83. /package/dist/lib/{rest → utils}/CDN.js +0 -0
package/README.md CHANGED
@@ -26,11 +26,13 @@ const {
26
26
  MessageFlags,
27
27
  } = require("disgroove");
28
28
  const client = new Client("B0t.T0k3N", {
29
- intents: GatewayIntents.All,
29
+ gateway: {
30
+ intents: GatewayIntents.All,
31
+ },
30
32
  });
31
33
 
32
34
  client.once("ready", () => {
33
- console.log(`${client.user.username} is now online!`);
35
+ console.log("Logged in as", client.user.username);
34
36
 
35
37
  client.createGlobalApplicationCommand(client.application.id, {
36
38
  name: "ping",
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, InteractionCallbackType, type MFALevel, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags } from "./constants";
2
+ import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type MFALevel, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes } from "./constants";
3
3
  import { Util } from "./utils";
4
4
  import { RequestManager, type File } from "./rest";
5
5
  import EventEmitter from "node:events";
@@ -17,7 +17,7 @@ import type { AutoModerationActionExecutionEventFields, ChannelPinsUpdateEventFi
17
17
  import type { Guild, GuildMember, WelcomeScreen, GuildWidgetSettings, Ban, Integration, GuildOnboarding, GuildPreview, GuildWidget, UnavailableGuild, OnboardingPrompt, WelcomeScreenChannel } from "./types/guild";
18
18
  import type { GuildScheduledEvent, GuildScheduledEventUser, GuildScheduledEventEntityMetadata } from "./types/guild-scheduled-event";
19
19
  import type { GuildTemplate } from "./types/guild-template";
20
- import type { Interaction, InteractionCallbackData } from "./types/interaction";
20
+ import type { Interaction, InteractionResponse } from "./types/interaction";
21
21
  import type { Invite } from "./types/invite";
22
22
  import type { ActionRow } from "./types/message-components";
23
23
  import type { PollCreateParams } from "./types/poll";
@@ -28,13 +28,23 @@ import type { Sticker, StickerPack } from "./types/sticker";
28
28
  import type { User, ApplicationRoleConnection, Connection } from "./types/user";
29
29
  import type { VoiceRegion, VoiceState } from "./types/voice";
30
30
  import type { Webhook } from "./types/webhook";
31
+ import type { ClientOptions as WebSocketOptions } from "ws";
31
32
  export interface ClientOptions {
32
- intents?: number | Array<number>;
33
33
  shardsCount?: number | "auto";
34
34
  auth?: "Bot" | "Bearer";
35
+ gateway?: {
36
+ intents?: number | Array<number>;
37
+ compress?: boolean;
38
+ largeThreshold?: number;
39
+ presence?: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>;
40
+ };
41
+ ws?: WebSocketOptions;
35
42
  }
36
43
  export declare class Client extends EventEmitter {
37
44
  token: string;
45
+ compress?: boolean;
46
+ largeThreshold?: number;
47
+ presence?: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>;
38
48
  intents: GatewayIntents | number;
39
49
  shardsCount: number | "auto";
40
50
  auth: "Bot" | "Bearer";
@@ -42,9 +52,10 @@ export declare class Client extends EventEmitter {
42
52
  rest: RequestManager;
43
53
  util: Util;
44
54
  guildShardMap: Record<string, number>;
45
- user: User;
55
+ user: User | null;
46
56
  guilds: Map<string, Guild>;
47
- application: Pick<Application, "id" | "flags">;
57
+ application: Pick<Application, "id" | "flags"> | null;
58
+ ws?: WebSocketOptions;
48
59
  constructor(token: string, options?: ClientOptions);
49
60
  /** https://discord.com/developers/docs/resources/channel#group-dm-add-recipient */
50
61
  addGroupRecipient(channelID: snowflake, userID: snowflake, options: {
@@ -68,7 +79,6 @@ export declare class Client extends EventEmitter {
68
79
  days: number;
69
80
  computePruneCount: boolean;
70
81
  includeRoles: Array<snowflake>;
71
- reason?: string;
72
82
  }, reason?: string): Promise<{
73
83
  pruned: number;
74
84
  }>;
@@ -89,12 +99,13 @@ export declare class Client extends EventEmitter {
89
99
  id?: snowflake;
90
100
  name: string;
91
101
  nameLocalizations?: LocaleMap | null;
92
- description?: string;
102
+ description: string;
93
103
  descriptionLocalizations?: LocaleMap | null;
94
104
  options?: Array<ApplicationCommandOption>;
95
105
  defaultMemberPermissions?: string | null;
96
- dmPermission?: boolean;
97
106
  defaultPermission?: boolean | null;
107
+ integrationTypes: Array<ApplicationIntegrationTypes>;
108
+ contexts: Array<InteractionContextTypes>;
98
109
  type?: ApplicationCommandTypes;
99
110
  nsfw?: boolean;
100
111
  }>): Promise<Array<ApplicationCommand>>;
@@ -103,13 +114,12 @@ export declare class Client extends EventEmitter {
103
114
  id?: snowflake;
104
115
  name: string;
105
116
  nameLocalizations?: LocaleMap | null;
106
- description?: string;
117
+ description: string;
107
118
  descriptionLocalizations?: LocaleMap | null;
108
119
  options?: Array<ApplicationCommandOption>;
109
120
  defaultMemberPermissions?: string | null;
110
- dmPermission?: boolean;
111
121
  defaultPermission?: boolean | null;
112
- type: ApplicationCommandTypes;
122
+ type?: ApplicationCommandTypes;
113
123
  nsfw?: boolean;
114
124
  }>): Promise<Array<ApplicationCommand>>;
115
125
  /** https://discord.com/developers/docs/topics/gateway#connections */
@@ -129,24 +139,24 @@ export declare class Client extends EventEmitter {
129
139
  }, reason?: string): Promise<AutoModerationRule>;
130
140
  /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
131
141
  createChannel(guildID: snowflake, options: {
132
- name: string | null;
133
- type?: ChannelTypes;
142
+ name: string;
143
+ type?: ChannelTypes | null;
134
144
  topic?: string | null;
135
- bitrate?: number;
136
- userLimit?: number;
137
- rateLimitPerUser?: number;
138
- position?: number;
145
+ bitrate?: number | null;
146
+ userLimit?: number | null;
147
+ rateLimitPerUser?: number | null;
148
+ position?: number | null;
139
149
  permissionOverwrites?: Array<Overwrite>;
140
150
  parentID?: snowflake | null;
141
- nsfw?: boolean;
151
+ nsfw?: boolean | null;
142
152
  rtcRegion?: string | null;
143
- videoQualityMode?: VideoQualityModes;
144
- defaultAutoArchiveDuration?: number;
153
+ videoQualityMode?: VideoQualityModes | null;
154
+ defaultAutoArchiveDuration?: number | null;
145
155
  defaultReactionEmoji?: DefaultReaction | null;
146
- availableTags?: Array<ForumTag>;
156
+ availableTags?: Array<ForumTag> | null;
147
157
  defaultSortOrder?: SortOrderTypes | null;
148
- defaultForumLayout?: ForumLayoutTypes;
149
- defaultThreadRateLimitPerUser?: number;
158
+ defaultForumLayout?: ForumLayoutTypes | null;
159
+ defaultThreadRateLimitPerUser?: number | null;
150
160
  }, reason?: string): Promise<Channel>;
151
161
  /** https://discord.com/developers/docs/resources/channel#create-channel-invite */
152
162
  createChannelInvite(channelID: snowflake, options: {
@@ -175,8 +185,9 @@ export declare class Client extends EventEmitter {
175
185
  descriptionLocalizations?: LocaleMap | null;
176
186
  options?: Array<ApplicationCommandOption>;
177
187
  defaultMemberPermissions?: string | null;
178
- dmPermission?: boolean;
179
188
  defaultPermission?: boolean | null;
189
+ integrationTypes?: Array<ApplicationIntegrationTypes>;
190
+ contexts?: Array<InteractionContextTypes>;
180
191
  type?: ApplicationCommandTypes;
181
192
  nsfw?: boolean;
182
193
  }): Promise<ApplicationCommand>;
@@ -188,7 +199,6 @@ export declare class Client extends EventEmitter {
188
199
  /** https://discord.com/developers/docs/resources/guild#create-guild */
189
200
  createGuild(options: {
190
201
  name: string;
191
- region?: string | null;
192
202
  icon?: string;
193
203
  verificationLevel?: VerificationLevel;
194
204
  defaultMessageNotifications?: DefaultMessageNotificationLevel;
@@ -253,13 +263,13 @@ export declare class Client extends EventEmitter {
253
263
  }, reason?: string): Promise<Role>;
254
264
  /** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
255
265
  createGuildScheduledEvent(guildID: snowflake, options: {
256
- channelID?: snowflake | null;
257
- entityMetadata?: GuildScheduledEventEntityMetadata | null;
266
+ channelID?: snowflake;
267
+ entityMetadata?: GuildScheduledEventEntityMetadata;
258
268
  name: string;
259
269
  privacyLevel: GuildScheduledEventPrivacyLevel;
260
270
  scheduledStartTime: string;
261
- scheduledEndTime?: string | null;
262
- description?: string | null;
271
+ scheduledEndTime?: string;
272
+ description?: string;
263
273
  entityType: GuildScheduledEventEntityTypes;
264
274
  image?: string;
265
275
  }, reason?: string): Promise<GuildScheduledEvent>;
@@ -277,23 +287,20 @@ export declare class Client extends EventEmitter {
277
287
  }): Promise<GuildTemplate>;
278
288
  /** https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message */
279
289
  createInteractionFollowupMessage(applicationID: snowflake, interactionToken: string, options: {
280
- content?: string | null;
290
+ content?: string;
281
291
  tts?: boolean;
282
- embeds?: Array<Embed> | null;
283
- allowedMentions?: AllowedMentions | null;
284
- components?: Array<ActionRow> | null;
292
+ embeds?: Array<Embed>;
293
+ allowedMentions?: AllowedMentions;
294
+ components?: Array<ActionRow>;
285
295
  files?: Array<File> | null;
286
- attachments?: Array<Attachment> | null;
287
- flags?: MessageFlags | null;
296
+ attachments?: Array<Pick<Attachment, "filename" | "description">>;
297
+ flags?: MessageFlags;
288
298
  threadName?: string;
289
299
  appliedTags?: Array<string>;
290
300
  poll?: PollCreateParams;
291
301
  }): Promise<Message>;
292
302
  /** https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response */
293
- createInteractionResponse(interactionID: snowflake, interactionToken: string, options: {
294
- type: InteractionCallbackType;
295
- data?: InteractionCallbackData;
296
- }): void;
303
+ createInteractionResponse(interactionID: snowflake, interactionToken: string, options: InteractionResponse): void;
297
304
  /** https://discord.com/developers/docs/resources/channel#create-message */
298
305
  createMessage(channelID: snowflake, options: {
299
306
  content?: string;
@@ -305,7 +312,7 @@ export declare class Client extends EventEmitter {
305
312
  components?: Array<ActionRow>;
306
313
  stickersIDs?: Array<snowflake>;
307
314
  files?: Array<File>;
308
- attachments?: Array<Attachment>;
315
+ attachments?: Array<Pick<Attachment, "filename" | "description">>;
309
316
  flags?: MessageFlags;
310
317
  enforceNonce?: boolean;
311
318
  poll?: PollCreateParams;
@@ -487,8 +494,8 @@ export declare class Client extends EventEmitter {
487
494
  installParams?: InstallParams;
488
495
  integrationTypesConfig?: Record<ApplicationIntegrationTypes, ApplicationIntegrationTypeConfiguration>;
489
496
  flags?: ApplicationFlags;
490
- icon?: string;
491
- coverImage?: string;
497
+ icon?: string | null;
498
+ coverImage?: string | null;
492
499
  interactionsEndpointURL?: string;
493
500
  tags?: Array<string>;
494
501
  }): Promise<Application>;
@@ -501,7 +508,8 @@ export declare class Client extends EventEmitter {
501
508
  options?: Array<ApplicationCommandOption>;
502
509
  defaultMemberPermissions?: string | null;
503
510
  defaultPermission?: boolean | null;
504
- dmPermission?: boolean;
511
+ integrationTypes?: Array<ApplicationIntegrationTypes>;
512
+ contexts?: Array<InteractionContextTypes>;
505
513
  nsfw?: boolean;
506
514
  }): Promise<ApplicationCommand>;
507
515
  /** https://discord.com/developers/docs/resources/guild#modify-guild */
@@ -684,21 +692,21 @@ export declare class Client extends EventEmitter {
684
692
  endPoll(channelID: snowflake, messageID: snowflake): Promise<Message>;
685
693
  /** https://discord.com/developers/docs/resources/webhook#execute-webhook */
686
694
  executeWebhook(webhookID: snowflake, webhookToken: string, options: {
687
- content?: string | null;
695
+ content?: string;
688
696
  username?: string;
689
697
  avatarURL?: string;
690
698
  tts?: boolean;
691
- embeds?: Array<Embed> | null;
692
- allowedMentions?: AllowedMentions | null;
693
- components?: Array<ActionRow> | null;
694
- files?: Array<File> | null;
695
- attachments?: Array<Attachment> | null;
696
- flags?: MessageFlags | null;
699
+ embeds?: Array<Embed>;
700
+ allowedMentions?: AllowedMentions;
701
+ components?: Array<ActionRow>;
702
+ files?: Array<File>;
703
+ attachments?: Array<Pick<Attachment, "filename" | "description">>;
704
+ flags?: MessageFlags;
697
705
  threadName?: string;
698
- appliedTags?: Array<string>;
706
+ appliedTags?: Array<snowflake>;
699
707
  poll?: PollCreateParams;
700
- wait: boolean;
701
- threadID: snowflake;
708
+ wait?: boolean;
709
+ threadID?: snowflake;
702
710
  }): Promise<Message | null>;
703
711
  /**
704
712
  * https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook
@@ -1001,7 +1009,7 @@ export declare class Client extends EventEmitter {
1001
1009
  /** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
1002
1010
  updateApplicationRoleConnectionMetadataRecords(applicationID: snowflake): Promise<Array<ApplicationRoleConnectionMetadata>>;
1003
1011
  /** https://discord.com/developers/docs/resources/user#update-current-user-application-role-connection */
1004
- updateCurrentApplicationRoleConnection(options: {
1012
+ updateCurrentApplicationRoleConnection(applicationID: snowflake, options: {
1005
1013
  platformName?: string;
1006
1014
  platformUsername?: string;
1007
1015
  metadata?: ApplicationRoleConnectionMetadata;