djs-selfbot-v13 3.7.16 → 3.7.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "djs-selfbot-v13",
3
- "version": "3.7.16",
3
+ "version": "3.7.18",
4
4
  "description": "An unofficial discord.js fork for creating selfbots",
5
5
  "main": "./src/index.js",
6
6
  "types": "./typings/index.d.ts",
@@ -301,9 +301,9 @@ class ClientUser extends User {
301
301
  const cs = options instanceof CustomStatus
302
302
  ? options
303
303
  : new CustomStatus(this.client, {
304
- state: options.state ?? null,
305
- emoji: options.emoji ? { name: options.emoji } : undefined,
306
- });
304
+ state: options.state ?? null,
305
+ emoji: options.emoji ? { name: options.emoji } : undefined,
306
+ });
307
307
 
308
308
  activity = cs.toJSON(); // { name, type, state, emoji }
309
309
 
@@ -748,6 +748,103 @@ class ClientUser extends User {
748
748
  deleteClan() {
749
749
  return this.client.api.users['@me'].clan.put({ data: { identity_guild_id: null, identity_enabled: false } });
750
750
  }
751
+
752
+ /**
753
+ * Fetch a user's profile
754
+ * @param {Snowflake} userId The user's ID
755
+ * @param {Object} [options] Options
756
+ * @param {string} [options.type='popout'] Profile type ('popout', 'full')
757
+ * @param {boolean} [options.withMutualGuilds=true] Include mutual guilds
758
+ * @param {boolean} [options.withMutualFriends=true] Include mutual friends
759
+ * @param {boolean} [options.withMutualFriendsCount=false] Include mutual friends count
760
+ * @param {Snowflake} [options.guildId] Guild ID for context
761
+ * @returns {Promise<UserProfile>}
762
+ */
763
+ async fetchProfile(userId, options = {}) {
764
+ const {
765
+ type = 'popout',
766
+ withMutualGuilds = true,
767
+ withMutualFriends = true,
768
+ withMutualFriendsCount = false,
769
+ guildId,
770
+ } = options;
771
+
772
+ const query = {
773
+ type,
774
+ with_mutual_guilds: withMutualGuilds,
775
+ with_mutual_friends: withMutualFriends,
776
+ with_mutual_friends_count: withMutualFriendsCount,
777
+ };
778
+
779
+ if (guildId) query.guild_id = guildId;
780
+
781
+ const data = await this.client.api.users(userId).profile.get({ query });
782
+
783
+ return {
784
+ user: {
785
+ id: data.user.id,
786
+ username: data.user.username,
787
+ globalName: data.user.global_name,
788
+ avatar: data.user.avatar,
789
+ avatarDecorationData: data.user.avatar_decoration_data ?? null,
790
+ discriminator: data.user.discriminator,
791
+ publicFlags: data.user.public_flags,
792
+ primaryGuild: data.user.primary_guild ?? null,
793
+ banner: data.user.banner ?? null,
794
+ bannerColor: data.user.banner_color ?? null,
795
+ accentColor: data.user.accent_color ?? null,
796
+ bio: data.user.bio ?? null,
797
+ displayNameStyles: data.user.display_name_styles ?? null,
798
+ collectibles: data.user.collectibles ?? null,
799
+ },
800
+ profile: {
801
+ bio: data.user_profile?.bio ?? null,
802
+ accentColor: data.user_profile?.accent_color ?? null,
803
+ pronouns: data.user_profile?.pronouns ?? null,
804
+ banner: data.user_profile?.banner ?? null,
805
+ themeColors: data.user_profile?.theme_colors ?? null,
806
+ profileEffect: data.user_profile?.profile_effect ?? null,
807
+ emoji: data.user_profile?.emoji ?? null,
808
+ },
809
+ premiumType: data.premium_type ?? null,
810
+ premiumSince: data.premium_since ? new Date(data.premium_since) : null,
811
+ premiumGuildSince: data.premium_guild_since ? new Date(data.premium_guild_since) : null,
812
+ badges: data.badges ?? [],
813
+ guildBadges: data.guild_badges ?? [],
814
+ connectedAccounts: data.connected_accounts ?? [],
815
+ mutualFriends: data.mutual_friends ?? [],
816
+ mutualFriendsCount: data.mutual_friends_count ?? 0,
817
+ mutualGuilds: data.mutual_guilds ?? [],
818
+ widgets: data.widgets ?? [],
819
+ guildMember: data.guild_member ? {
820
+ avatar: data.guild_member.avatar ?? null,
821
+ banner: data.guild_member.banner ?? null,
822
+ nick: data.guild_member.nick ?? null,
823
+ roles: data.guild_member.roles ?? [],
824
+ joinedAt: data.guild_member.joined_at ? new Date(data.guild_member.joined_at) : null,
825
+ premiumSince: data.guild_member.premium_since ? new Date(data.guild_member.premium_since) : null,
826
+ pending: data.guild_member.pending ?? false,
827
+ flags: data.guild_member.flags ?? 0,
828
+ communicationDisabledUntil: data.guild_member.communication_disabled_until
829
+ ? new Date(data.guild_member.communication_disabled_until)
830
+ : null,
831
+ bio: data.guild_member.bio ?? null,
832
+ mute: data.guild_member.mute ?? false,
833
+ deaf: data.guild_member.deaf ?? false,
834
+ } : null,
835
+ guildMemberProfile: data.guild_member_profile ? {
836
+ guildId: data.guild_member_profile.guild_id,
837
+ bio: data.guild_member_profile.bio ?? null,
838
+ pronouns: data.guild_member_profile.pronouns ?? null,
839
+ banner: data.guild_member_profile.banner ?? null,
840
+ accentColor: data.guild_member_profile.accent_color ?? null,
841
+ themeColors: data.guild_member_profile.theme_colors ?? null,
842
+ profileEffect: data.guild_member_profile.profile_effect ?? null,
843
+ emoji: data.guild_member_profile.emoji ?? null,
844
+ } : null,
845
+ legacyUsername: data.legacy_username ?? null,
846
+ };
847
+ }
751
848
  }
752
849
 
753
850
  module.exports = ClientUser;
@@ -1752,6 +1752,49 @@ class Guild extends AnonymousGuild {
1752
1752
  return data;
1753
1753
  }
1754
1754
 
1755
+ /**
1756
+ * Get the number of members that would be pruned
1757
+ * @param {number} [days=7] Number of days of inactivity
1758
+ * @param {string[]} [includeRoles=[]] Role IDs to include in the prune
1759
+ * @returns {Promise<number>} The number of members that would be pruned
1760
+ */
1761
+ async pruneCount(days = 7, includeRoles = []) {
1762
+ const query = { days };
1763
+
1764
+ if (includeRoles.length > 0) {
1765
+ query.include_roles = includeRoles.join('&include_roles=');
1766
+ }
1767
+
1768
+ const params = new URLSearchParams({ days: days.toString() });
1769
+ if (includeRoles.length > 0) {
1770
+ for (const roleId of includeRoles) {
1771
+ params.append('include_roles', roleId);
1772
+ }
1773
+ }
1774
+
1775
+ const data = await this.client.api.guilds(this.id)['prune/v2'].get({ query: Object.fromEntries(params) });
1776
+ return data.pruned;
1777
+ }
1778
+
1779
+ /**
1780
+ * Prune inactive members from the guild
1781
+ * @param {number} [days=7] Number of days of inactivity
1782
+ * @param {string[]} [includeRoles=[]] Role IDs to include in the prune
1783
+ * @param {boolean} [computePruneCount=false] Whether to return the number of pruned members
1784
+ * @returns {Promise<number|null>} The number of pruned members, or null if computePruneCount is false
1785
+ */
1786
+ async pruneMembers(days = 7, includeRoles = [], computePruneCount = false) {
1787
+ const data = await this.client.api.guilds(this.id).prune.post({
1788
+ data: {
1789
+ days,
1790
+ compute_prune_count: computePruneCount,
1791
+ include_roles: includeRoles
1792
+ }
1793
+ });
1794
+ return data.pruned ?? null;
1795
+ }
1796
+
1797
+
1755
1798
  /**
1756
1799
  * Creates a collection of this guild's roles, sorted by their position and ids.
1757
1800
  * @returns {Collection<Snowflake, Role>}
@@ -465,6 +465,7 @@ class User extends Base {
465
465
  this.globalName === user.global_name &&
466
466
  this.avatar === user.avatar &&
467
467
  this.flags?.bitfield === user.public_flags &&
468
+ ('bio' in data ? this.bio = data.bio : true)
468
469
  ('banner' in user ? this.banner === user.banner : true) &&
469
470
  ('accent_color' in user ? this.accentColor === user.accent_color : true) &&
470
471
  ('avatar_decoration_data' in user
@@ -994,6 +994,77 @@ export class ClientPresence extends Presence {
994
994
  public set(presence: PresenceData): ClientPresence;
995
995
  }
996
996
 
997
+ export interface FetchUserProfileOptions {
998
+ type?: 'popout' | 'full';
999
+ withMutualGuilds?: boolean;
1000
+ withMutualFriends?: boolean;
1001
+ withMutualFriendsCount?: boolean;
1002
+ guildId?: Snowflake;
1003
+ }
1004
+
1005
+ export interface UserProfile {
1006
+ user: {
1007
+ id: Snowflake;
1008
+ username: string;
1009
+ globalName: string | null;
1010
+ avatar: string | null;
1011
+ avatarDecorationData: AvatarDecorationData | null;
1012
+ discriminator: string;
1013
+ publicFlags: number;
1014
+ primaryGuild: UserPrimaryGuild | null;
1015
+ banner: string | null;
1016
+ bannerColor: string | null;
1017
+ accentColor: number | null;
1018
+ bio: string | null;
1019
+ displayNameStyles: { font_id: number; effect_id: number; colors: number[] } | null;
1020
+ collectibles: Collectibles | null;
1021
+ };
1022
+ profile: {
1023
+ bio: string | null;
1024
+ accentColor: number | null;
1025
+ pronouns: string | null;
1026
+ banner: string | null;
1027
+ themeColors: number[] | null;
1028
+ profileEffect: { id: Snowflake; sku_id: Snowflake; expires_at: string | null } | null;
1029
+ emoji: APIPartialEmoji | null;
1030
+ };
1031
+ premiumType: number | null;
1032
+ premiumSince: Date | null;
1033
+ premiumGuildSince: Date | null;
1034
+ badges: { id: string; description: string; icon: string; link?: string }[];
1035
+ guildBadges: unknown[];
1036
+ connectedAccounts: { type: string; id: string; name: string; verified: boolean }[];
1037
+ mutualFriends: unknown[];
1038
+ mutualFriendsCount: number;
1039
+ mutualGuilds: { id: Snowflake; nick: string | null }[];
1040
+ widgets: unknown[];
1041
+ guildMember: {
1042
+ avatar: string | null;
1043
+ banner: string | null;
1044
+ nick: string | null;
1045
+ roles: Snowflake[];
1046
+ joinedAt: Date | null;
1047
+ premiumSince: Date | null;
1048
+ pending: boolean;
1049
+ flags: number;
1050
+ communicationDisabledUntil: Date | null;
1051
+ bio: string | null;
1052
+ mute: boolean;
1053
+ deaf: boolean;
1054
+ } | null;
1055
+ guildMemberProfile: {
1056
+ guildId: Snowflake;
1057
+ bio: string | null;
1058
+ pronouns: string | null;
1059
+ banner: string | null;
1060
+ accentColor: number | null;
1061
+ themeColors: number[] | null;
1062
+ profileEffect: unknown | null;
1063
+ emoji: APIPartialEmoji | null;
1064
+ } | null;
1065
+ legacyUsername: string | null;
1066
+ }
1067
+
997
1068
  export class ClientUser extends User {
998
1069
  public mfaEnabled: boolean;
999
1070
  public readonly presence: ClientPresence;
@@ -1035,6 +1106,7 @@ export class ClientUser extends User {
1035
1106
  public widgetsList(): Promise<WidgetsResponse>;
1036
1107
  public setNameStyle(fontName: FontName | number, effectName: EffectName | number, color1: number | string, color2?: number | string | null): Promise<this>;
1037
1108
  public searchTab(options?: UserMessageSearchTabOptions): Promise<{ messages: any[][]; total_results: number }>;
1109
+ public fetchProfile(userId: Snowflake, options?: FetchUserProfileOptions): Promise<UserProfile>;
1038
1110
  }
1039
1111
 
1040
1112
  export class Options extends null {
@@ -1716,6 +1788,8 @@ export class Guild extends AnonymousGuild {
1716
1788
  rulesChannel?: GuildTextChannelResolvable,
1717
1789
  reason?: string,
1718
1790
  ): Promise<this>;
1791
+ public pruneMembers(days?: number, includeRoles?: string[], computePruneCount?: boolean): Promise<number | null>;
1792
+ public pruneCount(days?: number, includeRoles?: string[]): Promise<number>;
1719
1793
  public topEmojis(): Promise<Collection<number, GuildEmoji>>;
1720
1794
  public setVanityCode(code?: string): Promise<this>;
1721
1795
  public mute(options?: GuildMuteOptions): Promise<any>;
@@ -3994,6 +4068,7 @@ export class User extends PartialTextBasedChannel(Base) {
3994
4068
  public readonly avatarDecoration: string | null;
3995
4069
  public avatarDecorationData: AvatarDecorationData | null;
3996
4070
  public banner: string | null | undefined;
4071
+ public bio?: string | null;
3997
4072
  public bannerColor: string | null | undefined;
3998
4073
  public bot: boolean;
3999
4074
  public readonly createdAt: Date;