djs-selfbot-v13 3.7.17 → 3.7.19

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.17",
3
+ "version": "3.7.19",
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,83 @@ 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
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
+ // Résoudre l'objet User
784
+ const user = this.client.users._add(data.user);
785
+
786
+ // Résoudre le GuildMember si présent
787
+ let member = null;
788
+ if (data.guild_member) {
789
+ const resolvedGuildId = guildId ?? data.guild_member_profile?.guild_id;
790
+ const guild = resolvedGuildId ? this.client.guilds.cache.get(resolvedGuildId) : null;
791
+ if (guild) {
792
+ member = guild.members._add({
793
+ ...data.guild_member,
794
+ user: data.guild_member.user ?? data.user,
795
+ });
796
+ }
797
+ }
798
+
799
+ // Résoudre les mutual friends en vrais User
800
+ const mutualFriends = (data.mutual_friends ?? []).map(u => this.client.users._add(u));
801
+
802
+ return {
803
+ user,
804
+ member,
805
+ profile: {
806
+ bio: data.user_profile?.bio ?? null,
807
+ accentColor: data.user_profile?.accent_color ?? null,
808
+ pronouns: data.user_profile?.pronouns ?? null,
809
+ banner: data.user_profile?.banner ?? null,
810
+ themeColors: data.user_profile?.theme_colors ?? null,
811
+ profileEffect: data.user_profile?.profile_effect ?? null,
812
+ emoji: data.user_profile?.emoji ?? null,
813
+ },
814
+ premiumType: data.premium_type ?? null,
815
+ premiumSince: data.premium_since ? new Date(data.premium_since) : null,
816
+ premiumGuildSince: data.premium_guild_since ? new Date(data.premium_guild_since) : null,
817
+ badges: data.badges ?? [],
818
+ guildBadges: data.guild_badges ?? [],
819
+ connectedAccounts: data.connected_accounts ?? [],
820
+ mutualFriends,
821
+ mutualFriendsCount: data.mutual_friends_count ?? 0,
822
+ mutualGuilds: data.mutual_guilds ?? [],
823
+ widgets: data.widgets ?? [],
824
+ wishlistSettings: data.wishlist_settings ?? null,
825
+ guildMemberProfile: data.guild_member_profile ?? null,
826
+ legacyUsername: data.legacy_username ?? null,
827
+ };
828
+ }
829
+ }
753
830
  module.exports = ClientUser;
@@ -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 {