disgroove 2.2.2 → 2.2.3-dev.933ac5e

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/README.md CHANGED
@@ -9,13 +9,13 @@ A module to interface with Discord
9
9
 
10
10
  ## Installation
11
11
 
12
- [**NodeJS v18**](https://nodejs.org) or newer required
12
+ [**Node.js v18**](https://nodejs.org) or newer required
13
13
 
14
14
  ```
15
15
  npm install disgroove
16
16
  ```
17
17
 
18
- #### Example
18
+ ## Example
19
19
 
20
20
  ```js
21
21
  const {
@@ -1,11 +1,10 @@
1
1
  /// <reference types="node" />
2
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
- import { Util } from "./utils";
4
3
  import { RequestManager, type File } from "./rest";
5
4
  import EventEmitter from "node:events";
6
5
  import { ShardManager } from "./gateway";
7
6
  import type { Application, ApplicationIntegrationTypeConfiguration, InstallParams } from "./types/application";
8
- import type { ApplicationCommand, GuildApplicationCommandPermissions, ApplicationCommandOption } from "./types/application-command";
7
+ import type { ApplicationCommand, GuildApplicationCommandPermissions, ApplicationCommandOption, ApplicationCommandPermission } from "./types/application-command";
9
8
  import type { ApplicationRoleConnectionMetadata } from "./types/application-role-connection-metadata";
10
9
  import type { AuditLog, AuditLogEntry } from "./types/audit-log";
11
10
  import type { AutoModerationRule, TriggerMetadata, AutoModerationAction } from "./types/auto-moderation";
@@ -13,7 +12,7 @@ import type { Channel, Message, FollowedChannel, ThreadMember, Overwrite, Defaul
13
12
  import type { LocaleMap, snowflake, timestamp } from "./types/common";
14
13
  import type { Emoji } from "./types/emoji";
15
14
  import type { Entitlement } from "./types/entitlements";
16
- import type { AutoModerationActionExecutionEventFields, ChannelPinsUpdateEventFields, ThreadListSyncEventFields, ThreadMemberUpdateEventExtraFields, ThreadMembersUpdateEventFields, GuildCreateEventExtraFields, GuildAuditLogEntryCreateExtraFields, GuildBanAddEventFields, GuildBanRemoveEventFields, GuildMemberAddEventExtraFields, GuildMemberRemoveEventFields, GuildMemberUpdateEventFields, GuildMembersChunkEventFields, IntegrationCreateEventExtraFields, IntegrationUpdateEventExtraFields, IntegrationDeleteEventFields, InviteCreateEventFields, InviteDeleteEventFields, MessageCreateEventExtraFields, MessageDeleteEventFields, MessageDeleteBulkEventFields, MessageReactionAddEventFields, MessageReactionRemoveEventFields, MessageReactionRemoveAllEventFields, MessageReactionRemoveEmojiEventFields, PresenceUpdateEventFields, TypingStartEventFields, VoiceServerUpdateEventFields, MessagePollVoteAddFields, MessagePollVoteRemoveFields, GatewayPresenceUpdate, RawPayload } from "./types/gateway-events";
15
+ import type { AutoModerationActionExecutionEventFields, ChannelPinsUpdateEventFields, ThreadListSyncEventFields, ThreadMemberUpdateEventExtraFields, ThreadMembersUpdateEventFields, GuildCreateEventExtraFields, GuildAuditLogEntryCreateExtraFields, GuildBanAddEventFields, GuildBanRemoveEventFields, GuildMemberAddEventExtraFields, GuildMemberRemoveEventFields, GuildMemberUpdateEventFields, GuildMembersChunkEventFields, IntegrationCreateEventExtraFields, IntegrationUpdateEventExtraFields, IntegrationDeleteEventFields, InviteCreateEventFields, InviteDeleteEventFields, MessageCreateEventExtraFields, MessageDeleteEventFields, MessageDeleteBulkEventFields, MessageReactionAddEventFields, MessageReactionRemoveEventFields, MessageReactionRemoveAllEventFields, MessageReactionRemoveEmojiEventFields, PresenceUpdateEventFields, TypingStartEventFields, VoiceServerUpdateEventFields, MessagePollVoteAddFields, MessagePollVoteRemoveFields, GatewayPresenceUpdate, RawPayload, IdentifyConnectionProperties } from "./types/gateway-events";
17
16
  import type { Guild, GuildMember, WelcomeScreen, GuildWidgetSettings, Ban, Integration, GuildOnboarding, GuildPreview, GuildWidget, UnavailableGuild, OnboardingPrompt, WelcomeScreenChannel } from "./types/guild";
18
17
  import type { GuildScheduledEvent, GuildScheduledEventUser, GuildScheduledEventEntityMetadata } from "./types/guild-scheduled-event";
19
18
  import type { GuildTemplate } from "./types/guild-template";
@@ -29,19 +28,22 @@ import type { User, ApplicationRoleConnection, Connection } from "./types/user";
29
28
  import type { VoiceRegion, VoiceState } from "./types/voice";
30
29
  import type { Webhook } from "./types/webhook";
31
30
  import type { ClientOptions as WebSocketOptions } from "ws";
31
+ export interface GatewayOptions {
32
+ properties?: IdentifyConnectionProperties;
33
+ compress?: boolean;
34
+ largeThreshold?: number;
35
+ presence?: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>;
36
+ intents?: number | Array<number>;
37
+ }
32
38
  export interface ClientOptions {
33
39
  shardsCount?: number | "auto";
34
40
  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
+ gateway?: GatewayOptions;
41
42
  ws?: WebSocketOptions;
42
43
  }
43
44
  export declare class Client extends EventEmitter {
44
45
  token: string;
46
+ properties?: IdentifyConnectionProperties;
45
47
  compress?: boolean;
46
48
  largeThreshold?: number;
47
49
  presence?: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>;
@@ -50,7 +52,6 @@ export declare class Client extends EventEmitter {
50
52
  auth: "Bot" | "Bearer";
51
53
  shards: ShardManager;
52
54
  rest: RequestManager;
53
- util: Util;
54
55
  guildShardMap: Record<string, number>;
55
56
  user: User | null;
56
57
  guilds: Map<string, Guild>;
@@ -134,8 +135,8 @@ export declare class Client extends EventEmitter {
134
135
  triggerMetadata?: TriggerMetadata;
135
136
  actions: Array<AutoModerationAction>;
136
137
  enabled?: boolean;
137
- exemptRoles?: Array<string>;
138
- exemptChannels?: Array<string>;
138
+ exemptRoles?: Array<snowflake>;
139
+ exemptChannels?: Array<snowflake>;
139
140
  }, reason?: string): Promise<AutoModerationRule>;
140
141
  /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
141
142
  createChannel(guildID: snowflake, options: {
@@ -146,7 +147,7 @@ export declare class Client extends EventEmitter {
146
147
  userLimit?: number | null;
147
148
  rateLimitPerUser?: number | null;
148
149
  position?: number | null;
149
- permissionOverwrites?: Array<Overwrite>;
150
+ permissionOverwrites?: Array<Pick<Overwrite, "id" | "type"> & Partial<Overwrite>> | null;
150
151
  parentID?: snowflake | null;
151
152
  nsfw?: boolean | null;
152
153
  rtcRegion?: string | null;
@@ -339,15 +340,16 @@ export declare class Client extends EventEmitter {
339
340
  autoArchiveDuration?: number;
340
341
  rateLimitPerUser?: number | null;
341
342
  message: {
342
- content?: string | null;
343
- embeds?: Array<Embed> | null;
344
- allowedMentions?: AllowedMentions | null;
345
- components?: Array<ActionRow> | null;
346
- attachments?: Array<Attachment> | null;
347
- flags?: MessageFlags | null;
343
+ content?: string;
344
+ embeds?: Array<Embed>;
345
+ allowedMentions?: AllowedMentions;
346
+ components?: Array<ActionRow>;
347
+ stickerIDs?: Array<snowflake>;
348
+ attachments?: Array<Pick<Attachment, "filename" | "description">>;
349
+ flags?: MessageFlags;
350
+ files?: Array<File>;
348
351
  };
349
- appliedTags?: Array<string>;
350
- files?: Array<File> | null;
352
+ appliedTags?: Array<snowflake>;
351
353
  }, reason?: string): Promise<Channel>;
352
354
  /** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
353
355
  createThreadFromMessage(channelID: snowflake, messageID: snowflake, options: {
@@ -422,12 +424,12 @@ export declare class Client extends EventEmitter {
422
424
  triggerMetadata?: TriggerMetadata;
423
425
  actions?: Array<AutoModerationAction>;
424
426
  enabled?: boolean;
425
- exemptRoles?: Array<string>;
426
- exemptChannels?: Array<string>;
427
+ exemptRoles?: Array<snowflake>;
428
+ exemptChannels?: Array<snowflake>;
427
429
  }, reason?: string): Promise<AutoModerationRule>;
428
430
  /** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
429
431
  editApplicationCommandPermissions(applicationID: snowflake, guildID: snowflake, commandID: snowflake, options: {
430
- permissions: Array<GuildApplicationCommandPermissions>;
432
+ permissions: Array<ApplicationCommandPermission>;
431
433
  }): Promise<GuildApplicationCommandPermissions>;
432
434
  /** https://discord.com/developers/docs/resources/channel#modify-channel */
433
435
  editChannel(channelID: snowflake, options: {
@@ -440,7 +442,7 @@ export declare class Client extends EventEmitter {
440
442
  rateLimitPerUser?: number | null;
441
443
  bitrate?: number | null;
442
444
  userLimit?: number | null;
443
- permissionOverwrites?: Array<Overwrite> | null;
445
+ permissionOverwrites?: Array<Pick<Overwrite, "id" | "type"> & Partial<Overwrite>> | null;
444
446
  parentID?: snowflake | null;
445
447
  rtcRegion?: string | null;
446
448
  videoQualityMode?: VideoQualityModes | null;
@@ -455,7 +457,7 @@ export declare class Client extends EventEmitter {
455
457
  autoArchiveDuration?: number;
456
458
  locked?: boolean;
457
459
  invitable?: boolean;
458
- appliedTags?: Array<string>;
460
+ appliedTags?: Array<snowflake>;
459
461
  }, reason?: string): Promise<Channel>;
460
462
  /** https://discord.com/developers/docs/resources/channel#edit-channel-permissions */
461
463
  editChannelPermissions(channelID: snowflake, overwriteID: snowflake, options: {
@@ -478,7 +480,7 @@ export declare class Client extends EventEmitter {
478
480
  }): Promise<User>;
479
481
  /** https://discord.com/developers/docs/resources/guild#modify-current-member */
480
482
  editCurrentGuildMember(guildID: snowflake, options: {
481
- nick?: string;
483
+ nick?: string | null;
482
484
  }, reason?: string): Promise<GuildMember>;
483
485
  /** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
484
486
  editCurrentUserVoiceState(guildID: snowflake, options: {
@@ -515,10 +517,9 @@ export declare class Client extends EventEmitter {
515
517
  /** https://discord.com/developers/docs/resources/guild#modify-guild */
516
518
  editGuild(guildID: snowflake, options: {
517
519
  name?: string;
518
- region?: string | null;
519
- verificationLevel?: VerificationLevel;
520
- defaultMessageNotifications?: DefaultMessageNotificationLevel;
521
- explicitContentFilter?: ExplicitContentFilterLevel;
520
+ verificationLevel?: VerificationLevel | null;
521
+ defaultMessageNotifications?: DefaultMessageNotificationLevel | null;
522
+ explicitContentFilter?: ExplicitContentFilterLevel | null;
522
523
  afkChannelID?: snowflake | null;
523
524
  afkTimeout?: number;
524
525
  icon?: string | null;
@@ -530,7 +531,7 @@ export declare class Client extends EventEmitter {
530
531
  systemChannelFlags?: SystemChannelFlags;
531
532
  rulesChannelID?: snowflake | null;
532
533
  publicUpdatesChannelID?: snowflake | null;
533
- preferredLocale?: string;
534
+ preferredLocale?: string | null;
534
535
  features?: Array<GuildFeatures>;
535
536
  description?: string | null;
536
537
  premiumProgressBarEnabled?: boolean;
@@ -559,8 +560,8 @@ export declare class Client extends EventEmitter {
559
560
  mute?: boolean | null;
560
561
  deaf?: boolean | null;
561
562
  channelID?: snowflake | null;
562
- communicationDisabledUntil?: number | null;
563
- flags?: GuildMemberFlags;
563
+ communicationDisabledUntil?: timestamp | null;
564
+ flags?: GuildMemberFlags | null;
564
565
  }, reason?: string): Promise<GuildMember>;
565
566
  /** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
566
567
  editGuildMFALevel(guildID: snowflake, options: {
@@ -587,15 +588,15 @@ export declare class Client extends EventEmitter {
587
588
  editGuildRolePositions(guildID: snowflake, options: Array<{
588
589
  id: snowflake;
589
590
  position?: number | null;
590
- }>): Promise<Array<Role>>;
591
+ }>, reason?: string): Promise<Array<Role>>;
591
592
  /** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
592
593
  editGuildScheduledEvent(guildID: snowflake, guildScheduledEventID: snowflake, options: {
593
594
  channelID?: snowflake | null;
594
595
  entityMetadata?: GuildScheduledEventEntityMetadata | null;
595
596
  name?: string;
596
597
  privacyLevel?: GuildScheduledEventPrivacyLevel;
597
- scheduledStartTime?: string;
598
- scheduledEndTime?: string;
598
+ scheduledStartTime?: timestamp;
599
+ scheduledEndTime?: timestamp;
599
600
  description?: string | null;
600
601
  entityType?: GuildScheduledEventEntityTypes;
601
602
  status?: GuildScheduledEventStatus;
@@ -642,29 +643,26 @@ export declare class Client extends EventEmitter {
642
643
  editInteractionFollowupMessage(applicationID: snowflake, interactionToken: string, messageID: snowflake, options: {
643
644
  content?: string | null;
644
645
  embeds?: Array<Embed> | null;
645
- flags?: MessageFlags | null;
646
646
  allowedMentions?: AllowedMentions | null;
647
647
  components?: Array<ActionRow> | null;
648
648
  files?: Array<File> | null;
649
- attachments?: Array<Attachment> | null;
650
- threadID: snowflake;
649
+ attachments?: Array<Partial<Attachment>> | null;
650
+ threadID?: snowflake;
651
651
  }): Promise<Message>;
652
652
  /** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response */
653
653
  editInteractionResponse(applicationID: snowflake, interactionToken: string, options: {
654
654
  content?: string | null;
655
655
  embeds?: Array<Embed> | null;
656
- flags?: MessageFlags | null;
657
656
  allowedMentions?: AllowedMentions | null;
658
657
  components?: Array<ActionRow> | null;
659
658
  files?: Array<File> | null;
660
- attachments?: Array<Attachment> | null;
661
- threadID: snowflake;
659
+ attachments?: Array<Partial<Attachment>> | null;
660
+ threadID?: snowflake;
662
661
  }): Promise<Message>;
663
662
  /** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
664
663
  editUserVoiceState(guildID: snowflake, userID: snowflake, options: {
665
- channelID?: snowflake;
664
+ channelID: snowflake;
666
665
  suppress?: boolean;
667
- requestToSpeakTimestamp?: timestamp | null;
668
666
  }): void;
669
667
  /** https://discord.com/developers/docs/resources/webhook#modify-webhook */
670
668
  editWebhook(webhookID: snowflake, options: {
@@ -676,12 +674,11 @@ export declare class Client extends EventEmitter {
676
674
  editWebhookMessage(webhookID: snowflake, webhookToken: string, messageID: snowflake, options: {
677
675
  content?: string | null;
678
676
  embeds?: Array<Embed> | null;
679
- flags?: MessageFlags | null;
680
677
  allowedMentions?: AllowedMentions | null;
681
678
  components?: Array<ActionRow> | null;
682
679
  files?: Array<File> | null;
683
- attachments?: Array<Attachment> | null;
684
- threadID: snowflake;
680
+ attachments?: Array<Partial<Attachment>> | null;
681
+ threadID?: snowflake;
685
682
  }): Promise<Message>;
686
683
  /** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
687
684
  editWebhookWithToken(webhookID: snowflake, webhookToken: string, options: {
@@ -728,7 +725,7 @@ export declare class Client extends EventEmitter {
728
725
  }>;
729
726
  /** https://discord.com/developers/docs/resources/channel#list-public-archived-threads */
730
727
  getArchivedThreads(channelID: snowflake, archivedStatus: "public" | "private", options?: {
731
- before?: string;
728
+ before?: timestamp;
732
729
  limit?: number;
733
730
  }): Promise<{
734
731
  threads: Array<Channel>;
@@ -739,8 +736,8 @@ export declare class Client extends EventEmitter {
739
736
  getAuditLog(guildID: snowflake, options?: {
740
737
  userID?: snowflake;
741
738
  actionType?: ActionTypes;
742
- before?: string;
743
- after?: string;
739
+ before?: snowflake;
740
+ after?: snowflake;
744
741
  limit?: number;
745
742
  }): Promise<AuditLog>;
746
743
  /** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
@@ -770,9 +767,9 @@ export declare class Client extends EventEmitter {
770
767
  /** https://discord.com/developers/docs/monetization/entitlements#list-entitlements */
771
768
  getEntitlements(applicationID: snowflake, options?: {
772
769
  userID?: snowflake;
773
- skuIDs?: Array<string>;
774
- before?: string;
775
- after?: string;
770
+ skuIDs?: Array<snowflake>;
771
+ before?: snowflake;
772
+ after?: snowflake;
776
773
  limit?: number;
777
774
  guildID?: snowflake;
778
775
  excludeEnded?: boolean;
@@ -804,11 +801,11 @@ export declare class Client extends EventEmitter {
804
801
  }): Promise<Guild>;
805
802
  /** https://discord.com/developers/docs/resources/user#get-current-user-guilds */
806
803
  getGuilds(options?: {
807
- before?: string;
808
- after?: string;
804
+ before?: snowflake;
805
+ after?: snowflake;
809
806
  limit?: number;
810
807
  withCounts?: boolean;
811
- }): Promise<Array<Guild>>;
808
+ }): Promise<Array<Pick<Guild, "id" | "name" | "icon" | "owner" | "permissions" | "features" | "approximateMemberCount" | "approximatePresenceCount">>>;
812
809
  /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
813
810
  getGuildApplicationCommand(applicationID: snowflake, guildID: snowflake, commandID: snowflake): Promise<ApplicationCommand>;
814
811
  /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
@@ -822,8 +819,8 @@ export declare class Client extends EventEmitter {
822
819
  /** https://discord.com/developers/docs/resources/guild#get-guild-bans */
823
820
  getGuildBans(guildID: snowflake, options?: {
824
821
  limit?: number;
825
- before?: string;
826
- after?: string;
822
+ before?: snowflake;
823
+ after?: snowflake;
827
824
  }): Promise<Array<Ban>>;
828
825
  /** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
829
826
  getGuildEmoji(guildID: snowflake, emojiID: snowflake): Promise<Emoji>;
@@ -844,7 +841,7 @@ export declare class Client extends EventEmitter {
844
841
  /** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
845
842
  getGuildPruneCount(guildID: snowflake, options: {
846
843
  days: number;
847
- includeRoles: string | Array<string>;
844
+ includeRoles: string | Array<snowflake>;
848
845
  }): Promise<{
849
846
  pruned: number;
850
847
  }>;
@@ -858,8 +855,8 @@ export declare class Client extends EventEmitter {
858
855
  getGuildScheduledEventUsers(guildID: snowflake, guildScheduledEventID: snowflake, options?: {
859
856
  limit?: number;
860
857
  withMember?: boolean;
861
- before?: string;
862
- after?: string;
858
+ before?: snowflake;
859
+ after?: snowflake;
863
860
  }): Promise<Array<GuildScheduledEventUser>>;
864
861
  /** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
865
862
  getGuildSticker(guildID: snowflake, stickerID: snowflake): Promise<Sticker>;
@@ -902,7 +899,7 @@ export declare class Client extends EventEmitter {
902
899
  }): Promise<Invite>;
903
900
  /** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
904
901
  getJoinedPrivateArchivedThreads(channelID: snowflake, options?: {
905
- before?: string;
902
+ before?: snowflake;
906
903
  limit?: number;
907
904
  }): Promise<{
908
905
  threads: Array<Channel>;
@@ -914,14 +911,14 @@ export declare class Client extends EventEmitter {
914
911
  /** https://discord.com/developers/docs/resources/channel#get-reactions */
915
912
  getMessageReactions(channelID: snowflake, messageID: snowflake, emoji: string, options?: {
916
913
  type?: ReactionTypes;
917
- after?: string;
914
+ after?: snowflake;
918
915
  limit?: number;
919
916
  }): Promise<Array<User>>;
920
917
  /** https://discord.com/developers/docs/resources/channel#get-channel-messages */
921
918
  getMessages(channelID: snowflake, options: {
922
- around?: string;
923
- before?: string;
924
- after?: string;
919
+ around?: snowflake;
920
+ before?: snowflake;
921
+ after?: snowflake;
925
922
  limit?: number;
926
923
  }): Promise<Array<Message>>;
927
924
  /** https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information */
@@ -937,7 +934,7 @@ export declare class Client extends EventEmitter {
937
934
  getPinnedMessages(channelID: snowflake): Promise<Array<Message>>;
938
935
  /** https://discord.com/developers/docs/resources/poll#get-answer-voters */
939
936
  getPollAnswerVoters(channelID: snowflake, messageID: snowflake, answerID: snowflake, options?: {
940
- after?: string;
937
+ after?: snowflake;
941
938
  limit?: number;
942
939
  }): Promise<{
943
940
  users: Array<User>;
@@ -957,7 +954,7 @@ export declare class Client extends EventEmitter {
957
954
  /** https://discord.com/developers/docs/resources/channel#list-thread-members */
958
955
  getThreadMembers(channelID: snowflake, options?: {
959
956
  withMember?: boolean;
960
- after?: string;
957
+ after?: snowflake;
961
958
  limit?: number;
962
959
  }): Promise<Array<ThreadMember>>;
963
960
  /** https://discord.com/developers/docs/resources/user#get-user */