djs-selfbot-v13 3.1.8 → 3.2.2

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 (43) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -8
  3. package/package.json +85 -71
  4. package/src/client/BaseClient.js +1 -1
  5. package/src/client/Client.js +81 -10
  6. package/src/client/actions/GuildMemberRemove.js +0 -1
  7. package/src/client/actions/GuildMemberUpdate.js +0 -1
  8. package/src/client/websocket/WebSocketShard.js +3 -3
  9. package/src/client/websocket/handlers/GUILD_CREATE.js +13 -14
  10. package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +0 -1
  11. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.js +22 -0
  12. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.js +12 -0
  13. package/src/client/websocket/handlers/READY.js +61 -21
  14. package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +1 -1
  15. package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +1 -1
  16. package/src/client/websocket/handlers/index.js +2 -0
  17. package/src/errors/Messages.js +1 -0
  18. package/src/index.js +4 -3
  19. package/src/managers/ChannelManager.js +1 -1
  20. package/src/managers/ClientUserSettingManager.js +2 -2
  21. package/src/managers/GuildBanManager.js +46 -0
  22. package/src/managers/GuildChannelManager.js +0 -16
  23. package/src/managers/GuildForumThreadManager.js +3 -3
  24. package/src/managers/GuildManager.js +1 -1
  25. package/src/managers/GuildMemberManager.js +11 -7
  26. package/src/managers/RelationshipManager.js +3 -3
  27. package/src/rest/APIRequest.js +13 -7
  28. package/src/structures/ClientPresence.js +9 -12
  29. package/src/structures/ClientUser.js +0 -2
  30. package/src/structures/Message.js +67 -76
  31. package/src/structures/MessagePayload.js +2 -0
  32. package/src/structures/MessagePoll.js +238 -0
  33. package/src/structures/Modal.js +11 -24
  34. package/src/structures/Presence.js +786 -128
  35. package/src/structures/User.js +35 -1
  36. package/src/structures/interfaces/TextBasedChannel.js +21 -23
  37. package/src/util/Constants.js +17 -4
  38. package/src/util/Options.js +1 -7
  39. package/src/util/Permissions.js +10 -0
  40. package/src/util/Util.js +88 -2
  41. package/typings/enums.d.ts +7 -1
  42. package/typings/index.d.ts +112 -70
  43. package/src/structures/RichPresence.js +0 -702
@@ -98,9 +98,10 @@ import {
98
98
  SortOrderType,
99
99
  ForumLayoutType,
100
100
  ApplicationRoleConnectionMetadataTypes,
101
- RelationshipTypes,
101
+ RelationshipType,
102
102
  SelectMenuComponentTypes,
103
103
  InviteType,
104
+ MessagePollLayoutType,
104
105
  } from './enums';
105
106
  import {
106
107
  APIApplicationRoleConnectionMetadata,
@@ -173,25 +174,9 @@ export interface RichButton {
173
174
  url: string;
174
175
  }
175
176
 
176
- export class RichPresence {
177
- public constructor(client?: Client, data?: object, IPC?: boolean);
178
- public application_id: Snowflake | null;
179
- public assets: RichPresenceAssets | null;
180
- public buttons: string[];
181
- public details: string | null;
182
- public name: string;
183
- public party: {
184
- id: string | null;
185
- size: [number, number];
186
- } | null;
187
- public state: string | null;
188
- public timestamps: {
189
- start: Date | null;
190
- end: Date | null;
191
- } | null;
192
- public type: ActivityType;
193
- public url: string | null;
194
- public ipc: boolean;
177
+ export class RichPresence extends Activity {
178
+ public constructor(client: Client, data?: object);
179
+ public metadata: RichPresenceMetadata;
195
180
  public setAssetsLargeImage(image?: string): this;
196
181
  public setAssetsLargeText(text?: string): this;
197
182
  public setAssetsSmallImage(image?: string): this;
@@ -203,10 +188,12 @@ export class RichPresence {
203
188
  public setDetails(details?: string): this;
204
189
  public setState(state?: string): this;
205
190
  public setParty(party?: { max: number; current: number; id?: string }): this;
206
- public setStartTimestamp(timestamp?: Date): this;
207
- public setEndTimestamp(timestamp?: Date): this;
191
+ public setStartTimestamp(timestamp: Date | number | null): this;
192
+ public setEndTimestamp(timestamp: Date | number | null): this;
208
193
  public setButtons(...button: RichButton[]): this;
209
194
  public addButton(name: string, url: string): this;
195
+ public setJoinSecret(join?: string): this;
196
+ public setPlatform(platform?: ActivityPlatform): this;
210
197
  public static getExternal(
211
198
  client: Client,
212
199
  applicationId: Snowflake,
@@ -243,62 +230,39 @@ export interface ExternalAssets {
243
230
  external_asset_path: string;
244
231
  }
245
232
 
246
- export interface SpotifyMetadata {
247
- album_id: string;
248
- artist_ids: string[];
233
+ export interface RichPresenceMetadata {
234
+ album_id?: string;
235
+ artist_ids?: string[];
236
+ context_uri?: string;
237
+ button_urls?: string[];
249
238
  }
250
239
 
251
240
  export class SpotifyRPC extends RichPresence {
252
241
  public constructor(client: Client, data?: object);
253
- public application_id: Snowflake | null;
254
- public client: Client;
255
- public assets: RichPresenceAssets | null;
256
- public buttons: string[];
257
- public details: string | null;
258
- public name: string;
259
- public sync_id: string;
260
- public id: string;
261
- public flags: number;
262
- public party: {
263
- id: string | null;
264
- size: [number, number];
265
- } | null;
266
- public state: string | null;
267
- public timestamps: {
268
- start: Date | null;
269
- end: Date | null;
270
- } | null;
271
- public type: ActivityType;
272
- public url: string | null;
273
- public metadata: SpotifyMetadata;
274
- public setAssetsLargeImage(image?: string): this;
275
- public setAssetsSmallImage(image?: string): this;
276
242
  public setSongId(id: string): this;
277
243
  public addArtistId(id: string): this;
278
244
  public setArtistIds(...ids: string[]): this;
279
245
  public setAlbumId(id: string): this;
280
246
  }
281
247
 
282
- export class CustomStatus {
283
- public constructor(data?: object);
284
- public emoji: EmojiIdentifierResolvable;
285
- public state: string;
248
+ export class CustomStatus extends Activity {
249
+ public constructor(client: Client, data?: object);
286
250
  public setEmoji(emoji?: EmojiIdentifierResolvable): this;
287
251
  public setState(state: string): this;
288
- public toJSON(): object;
289
252
  public toString(): string;
253
+ public toJSON(): unknown;
290
254
  }
291
255
 
292
256
  export class Activity {
293
- private constructor(presence: Presence, data?: RawActivityData);
257
+ public constructor(presence: Presence, data?: RawActivityData);
294
258
  public readonly presence: Presence;
295
259
  public applicationId: Snowflake | null;
296
- public assets: RichPresenceAssets | null;
260
+ public assets: RichPresenceAssets;
297
261
  public buttons: string[];
298
262
  public readonly createdAt: Date;
299
263
  public createdTimestamp: number;
300
264
  public details: string | null;
301
- public emoji: Emoji | null;
265
+ public emoji: EmojiIdentifierResolvable | null;
302
266
  public flags: Readonly<ActivityFlags>;
303
267
  public id: string;
304
268
  public name: string;
@@ -311,8 +275,8 @@ export class Activity {
311
275
  public state: string | null;
312
276
  public syncId: string | null;
313
277
  public timestamps: {
314
- start: Date | null;
315
- end: Date | null;
278
+ start: number | null;
279
+ end: number | null;
316
280
  } | null;
317
281
  public type: ActivityType;
318
282
  public url: string | null;
@@ -808,6 +772,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
808
772
  public fetchGuildWidget(guild: GuildResolvable): Promise<Widget>;
809
773
  public sleep(timeout: number): Promise<void>;
810
774
  public login(token?: string): Promise<string>;
775
+ public passLogin(email: string, password: string, code?: string | number): Promise<string | null>;
811
776
  public QRLogin(): Promise<void>;
812
777
  public logout(): Promise<void>;
813
778
  public isReady(): this is Client<true>;
@@ -820,6 +785,8 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
820
785
  ): Promise<Guild | DMChannel | GroupDMChannel>;
821
786
  public redeemNitro(nitro: string, channel?: TextChannelResolvable, paymentSourceId?: Snowflake): Promise<any>;
822
787
  public authorizeURL(url: string, options?: OAuth2AuthorizeOptions): Promise<any>;
788
+ public installUserApps(applicationId: Snowflake): Promise<void>;
789
+ public deauthorize(applicationId: Snowflake): Promise<void>;
823
790
 
824
791
  public on<K extends keyof ClientEvents>(event: K, listener: (...args: ClientEvents[K]) => Awaitable<void>): this;
825
792
  public on<S extends string | symbol>(
@@ -1882,6 +1849,7 @@ export class Message<Cached extends boolean = boolean> extends Base {
1882
1849
  public type: MessageType;
1883
1850
  public readonly url: string;
1884
1851
  public webhookId: Snowflake | null;
1852
+ public poll: MessagePoll | null;
1885
1853
  public flags: Readonly<MessageFlags>;
1886
1854
  public reference: MessageReference | null;
1887
1855
  public position: number | null;
@@ -1915,6 +1883,13 @@ export class Message<Cached extends boolean = boolean> extends Base {
1915
1883
  public markUnread(): Promise<void>;
1916
1884
  public markRead(): Promise<void>;
1917
1885
  public report(breadcrumbs: number[], elements?: object): Promise<{ report_id: Snowflake }>;
1886
+ public vote(...ids: number[]): Promise<void>;
1887
+ public endPoll(): Promise<RawMessageData>;
1888
+ public getAnswerVoter(
1889
+ answerId: number,
1890
+ afterUserId?: Snowflake,
1891
+ limit?: number,
1892
+ ): Promise<{ users: Partial<RawUserData> }>;
1918
1893
  }
1919
1894
 
1920
1895
  export class CallState extends Base {
@@ -1926,6 +1901,14 @@ export class CallState extends Base {
1926
1901
  public setRTCRegion(): Promise<void>;
1927
1902
  }
1928
1903
 
1904
+ export interface MessagePollUserVote {
1905
+ user_id: Snowflake;
1906
+ message_id: Snowflake;
1907
+ channel_id: Snowflake;
1908
+ answer_id: number;
1909
+ guild_id?: Snowflake;
1910
+ }
1911
+
1929
1912
  export class MessageActionRow<
1930
1913
  T extends MessageActionRowComponent | ModalActionRowComponent = MessageActionRowComponent,
1931
1914
  U = T extends ModalActionRowComponent ? ModalActionRowComponentResolvable : MessageActionRowComponentResolvable,
@@ -2295,10 +2278,44 @@ export class Modal {
2295
2278
  public channelId: Snowflake;
2296
2279
  public readonly channel: TextBasedChannel;
2297
2280
  public readonly guild: Guild | null;
2281
+ public readonly replied: boolean;
2298
2282
  public reply(): Promise<Message | Modal>;
2299
2283
  public toJSON(): RawModalSubmitInteractionData;
2300
2284
  }
2301
2285
 
2286
+ export interface MessagePollMedia {
2287
+ text?: string;
2288
+ emoji?: RawEmojiData;
2289
+ }
2290
+
2291
+ export interface MessagePollResultAnswerCount {
2292
+ answer: MessagePollMedia;
2293
+ count: number;
2294
+ selfVoted: boolean;
2295
+ }
2296
+
2297
+ export interface MessagePollResult {
2298
+ isFinalized: boolean;
2299
+ answerCounts: Collection<number, MessagePollResultAnswerCount>;
2300
+ }
2301
+
2302
+ export class MessagePoll {
2303
+ public constructor(data: MessagePoll | object);
2304
+ public question: MessagePollMedia | null;
2305
+ public answers: Collection<number, MessagePollMedia>;
2306
+ public layoutType: MessagePollLayoutType | null;
2307
+ public allowMultiSelect: boolean;
2308
+ public expiry: Date | null;
2309
+ public results: MessagePollResult | null;
2310
+ public duration: number | null;
2311
+ public toJSON(): object;
2312
+ public setQuestion(text: string): this;
2313
+ public setAnswers(answers: MessagePollMedia[]): this;
2314
+ public addAnswer(answer: MessagePollMedia): this;
2315
+ public setAllowMultiSelect(state: boolean): this;
2316
+ public setDuration(duration: number): this;
2317
+ }
2318
+
2302
2319
  export class ModalSubmitFieldsResolver {
2303
2320
  constructor(components: PartialModalActionRow[]);
2304
2321
  private readonly _fields: PartialTextInputData[];
@@ -2481,6 +2498,12 @@ export class RichPresenceAssets {
2481
2498
  public smallText: string | null;
2482
2499
  public largeImageURL(options?: StaticImageURLOptions): string | null;
2483
2500
  public smallImageURL(options?: StaticImageURLOptions): string | null;
2501
+ public static parseImage(image: string): string | null;
2502
+ public toJSON(): unknown;
2503
+ public setLargeImage(image?: string): this;
2504
+ public setLargeText(text?: string): this;
2505
+ public setSmallImage(image?: string): this;
2506
+ public setSmallText(text?: string): this;
2484
2507
  }
2485
2508
 
2486
2509
  export class Role extends Base {
@@ -3093,6 +3116,13 @@ export class Typing extends Base {
3093
3116
  };
3094
3117
  }
3095
3118
 
3119
+ export interface UserClan {
3120
+ identityGuildId?: Snowflake;
3121
+ identityEnabled?: boolean;
3122
+ tag?: string;
3123
+ badge?: string;
3124
+ }
3125
+
3096
3126
  export class User extends PartialTextBasedChannel(Base) {
3097
3127
  protected constructor(client: Client, data: RawUserData);
3098
3128
  private _equals(user: APIUser): boolean;
@@ -3120,11 +3150,13 @@ export class User extends PartialTextBasedChannel(Base) {
3120
3150
  public username: string;
3121
3151
  public readonly note: string | undefined;
3122
3152
  public readonly voice?: VoiceState;
3123
- public readonly relationship: RelationshipTypes;
3153
+ public readonly relationship: RelationshipType;
3124
3154
  public readonly friendNickname: string | null | undefined;
3155
+ public clan: UserClan | null;
3125
3156
  public avatarURL(options?: ImageURLOptions): string | null;
3126
3157
  public avatarDecorationURL(options?: StaticImageURLOptions): string | null;
3127
3158
  public bannerURL(options?: ImageURLOptions): string | null;
3159
+ public clanBadgeURL(): string | null;
3128
3160
  public createDM(force?: boolean): Promise<DMChannel>;
3129
3161
  public deleteDM(): Promise<DMChannel>;
3130
3162
  public displayAvatarURL(options?: ImageURLOptions): string;
@@ -3514,6 +3546,7 @@ export const Constants: {
3514
3546
  dynamic: boolean,
3515
3547
  ): string;
3516
3548
  AvatarDecoration(userId: Snowflake, hash: string, format: AllowedImageFormat, size: AllowedImageSize): string;
3549
+ ClanBadge(guildId: Snowflake, hash: string): string;
3517
3550
  Banner(id: Snowflake, hash: string, format: DynamicImageFormat, size: AllowedImageSize, dynamic: boolean): string;
3518
3551
  DefaultAvatar(index: number): string;
3519
3552
  DiscoverySplash(guildId: Snowflake, hash: string, format: AllowedImageFormat, size: AllowedImageSize): string;
@@ -3555,7 +3588,7 @@ export const Constants: {
3555
3588
  GuildScheduledEventStatuses: EnumHolder<typeof GuildScheduledEventStatuses>;
3556
3589
  IntegrationExpireBehaviors: IntegrationExpireBehaviors[];
3557
3590
  SelectMenuComponentTypes: EnumHolder<typeof SelectMenuComponentTypes>;
3558
- RelationshipTypes: EnumHolder<typeof RelationshipTypes>;
3591
+ RelationshipTypes: EnumHolder<typeof RelationshipType>;
3559
3592
  MembershipStates: EnumHolder<typeof MembershipStates>;
3560
3593
  MessageButtonStyles: EnumHolder<typeof MessageButtonStyles>;
3561
3594
  MessageComponentTypes: EnumHolder<typeof MessageComponentTypes>;
@@ -3755,22 +3788,22 @@ export class RelationshipManager extends BaseManager {
3755
3788
  client: Client,
3756
3789
  data: {
3757
3790
  user: RawUserData;
3758
- type: RelationshipTypes;
3791
+ type: RelationshipType;
3759
3792
  since?: string;
3760
3793
  nickname: string | null | undefined;
3761
3794
  id: Snowflake;
3762
3795
  }[],
3763
3796
  );
3764
- public cache: Collection<Snowflake, RelationshipTypes>;
3797
+ public cache: Collection<Snowflake, RelationshipType>;
3765
3798
  public friendNicknames: Collection<Snowflake, string | null>;
3766
3799
  public sinceCache: Collection<Snowflake, Date>;
3767
3800
  public readonly friendCache: Collection<Snowflake, User>;
3768
3801
  public readonly blockedCache: Collection<Snowflake, User>;
3769
3802
  public readonly incomingCache: Collection<Snowflake, User>;
3770
3803
  public readonly outgoingCache: Collection<Snowflake, User>;
3771
- public toJSON(): { type: RelationshipTypes; since: string; nickname: string | null | undefined; id: Snowflake }[];
3804
+ public toJSON(): { type: RelationshipType; since: string; nickname: string | null | undefined; id: Snowflake }[];
3772
3805
  public resolveId(user: UserResolvable): Snowflake | undefined;
3773
- public fetch(user?: UserResolvable, options?: BaseFetchOptions): Promise<RelationshipTypes | RelationshipManager>;
3806
+ public fetch(user?: UserResolvable, options?: BaseFetchOptions): Promise<RelationshipType | RelationshipManager>;
3774
3807
  public deleteRelationship(user: UserResolvable): Promise<boolean>;
3775
3808
  public sendFriendRequest(options: FriendRequestOptions): Promise<boolean>;
3776
3809
  public addFriend(user: UserResolvable): Promise<boolean>;
@@ -3965,7 +3998,6 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
3965
3998
  options?: SetChannelPositionOptions,
3966
3999
  ): Promise<GuildChannel>;
3967
4000
  public setPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;
3968
- public fetchActiveThreads(cache?: boolean): Promise<FetchedThreads>;
3969
4001
  public delete(channel: GuildChannelResolvable, reason?: string): Promise<void>;
3970
4002
  }
3971
4003
 
@@ -4383,7 +4415,7 @@ export interface ActivityOptions {
4383
4415
  shardId?: number | readonly number[];
4384
4416
  }
4385
4417
 
4386
- export type ActivityPlatform = 'desktop' | 'samsung' | 'xbox';
4418
+ export type ActivityPlatform = 'desktop' | 'samsung' | 'xbox' | 'ios' | 'android' | 'embedded' | 'ps4' | 'ps5';
4387
4419
 
4388
4420
  export type ActivityType = keyof typeof ActivityTypes;
4389
4421
 
@@ -5238,18 +5270,18 @@ export interface ClientEvents extends BaseClientEvents {
5238
5270
  guildAuditLogEntryCreate: [auditLogEntry: GuildAuditLogsEntry, guild: Guild];
5239
5271
  unhandledPacket: [packet: { t?: string; d: any }, shard: number];
5240
5272
  relationshipAdd: [userId: Snowflake, shouldNotify: boolean];
5241
- relationshipRemove: [userId: Snowflake, type: RelationshipTypes, nickname: string | null];
5273
+ relationshipRemove: [userId: Snowflake, type: RelationshipType, nickname: string | null];
5242
5274
  relationshipUpdate: [
5243
5275
  userId: Snowflake,
5244
5276
  oldData: {
5245
5277
  nickname: string | null;
5246
5278
  since: Date;
5247
- type: RelationshipTypes;
5279
+ type: RelationshipType;
5248
5280
  },
5249
5281
  newData: {
5250
5282
  nickname: string | null;
5251
5283
  since: Date;
5252
- type: RelationshipTypes;
5284
+ type: RelationshipType;
5253
5285
  },
5254
5286
  ];
5255
5287
  channelRecipientAdd: [channel: GroupDMChannel, user: User];
@@ -5258,6 +5290,8 @@ export interface ClientEvents extends BaseClientEvents {
5258
5290
  callCreate: [call: CallState];
5259
5291
  callUpdate: [call: CallState];
5260
5292
  callDelete: [call: CallState];
5293
+ messagePollVoteAdd: [data: MessagePollUserVote];
5294
+ messagePollVoteRemove: [data: MessagePollUserVote];
5261
5295
  }
5262
5296
 
5263
5297
  export interface ClientFetchInviteOptions {
@@ -5539,6 +5573,8 @@ export interface ConstantsEvents {
5539
5573
  CALL_CREATE: 'callCreate';
5540
5574
  CALL_UPDATE: 'callUpdate';
5541
5575
  CALL_DELETE: 'callDelete';
5576
+ MESSAGE_POLL_VOTE_ADD: 'messagePollVoteAdd';
5577
+ MESSAGE_POLL_VOTE_REMOVE: 'messagePollVoteRemove';
5542
5578
  }
5543
5579
 
5544
5580
  export interface ConstantsOpcodes {
@@ -6612,6 +6648,7 @@ export interface MessageOptions {
6612
6648
  stickers?: StickerResolvable[];
6613
6649
  attachments?: MessageAttachment[];
6614
6650
  flags?: BitFieldResolvable<'SUPPRESS_EMBEDS' | 'SUPPRESS_NOTIFICATIONS' | 'IS_VOICE_MESSAGE', number>;
6651
+ poll?: MessagePoll;
6615
6652
  }
6616
6653
 
6617
6654
  export type MessageReactionResolvable = MessageReaction | Snowflake | string;
@@ -6787,9 +6824,14 @@ export type PermissionString =
6787
6824
  | 'MANAGE_EVENTS'
6788
6825
  | 'VIEW_CREATOR_MONETIZATION_ANALYTICS'
6789
6826
  | 'USE_SOUNDBOARD'
6827
+ | 'CREATE_GUILD_EXPRESSIONS'
6828
+ | 'CREATE_EVENTS'
6829
+ | 'USE_EXTERNAL_SOUNDS'
6790
6830
  | 'SEND_VOICE_MESSAGES'
6791
6831
  | 'USE_CLYDE_AI'
6792
- | 'SET_VOICE_CHANNEL_STATUS';
6832
+ | 'SET_VOICE_CHANNEL_STATUS'
6833
+ | 'SEND_POLLS'
6834
+ | 'USE_EXTERNAL_APPS';
6793
6835
 
6794
6836
  export type RecursiveArray<T> = ReadonlyArray<T | RecursiveArray<T>>;
6795
6837