chore: release v2.8.8

- User.themeColors
- Update ClientBuild
This commit is contained in:
March 7th 2022-10-26 19:38:09 +07:00
parent f8246be0aa
commit 0c3d922096
7 changed files with 89 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "discord.js-selfbot-v13",
"version": "2.8.7",
"version": "2.8.8",
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js",
"types": "./typings/index.d.ts",

View File

@ -5,6 +5,7 @@ const Invite = require('./Invite');
const { Message } = require('./Message');
const User = require('./User');
const { Util } = require('..');
const { Error: Error_ } = require('../errors');
const { Opcodes, NitroType, HypeSquadType } = require('../util/Constants');
const DataResolver = require('../util/DataResolver');
const PurchasedFlags = require('../util/PurchasedFlags');
@ -487,6 +488,31 @@ class ClientUser extends User {
}
return collection;
}
/**
* Change Theme color
* @param {ColorResolvable} primary The primary color of the user's profile
* @param {ColorResolvable} accent The accent color of the user's profile
* @returns {Promise<ClientUser>}
*/
async setThemeColors(primary, accent) {
if (!primary || !accent) throw new Error('PRIMARY_COLOR or ACCENT_COLOR are required.');
// Check nitro
if (this.nitroType !== 'NITRO_BOOST') {
throw new Error_('NITRO_BOOST_REQUIRED', 'themeColors');
}
primary = Util.resolveColor(primary) || this.themeColors[0];
accent = Util.resolveColor(accent) || this.themeColors[1];
const data_ = await this.client.api.users['@me'].profile.patch({
data: {
theme_colors: [primary, accent],
},
});
this._ProfilePatch({
user_profile: data_,
});
return this;
}
}
module.exports = ClientUser;

View File

@ -122,6 +122,24 @@ class GuildMember extends Base {
*/
this.bio = data.bio;
}
if ('theme_colors' in data) {
/**
* The member's theme colors (Profile theme) [Primary, Accent]
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {?Array<number>}
*/
this.themeColors = data.theme_colors;
}
}
/**
* The hexadecimal version of the user theme color, with a leading hash [Primary, Accent]
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {?Array<string>}
* @readonly
*/
get hexThemeColor() {
return this.themeColors?.map(c => `#${c.toString(16).padStart(6, '0')}`) || null;
}
_clone() {
@ -540,6 +558,14 @@ class GuildMember extends Base {
);
}
/**
* Get profile guildMember
* @returns {Promise<User>}
*/
getProfile() {
return this.user.getProfile(this.guild.id);
}
/**
* When concatenated with a string, this automatically returns the user's mention instead of the GuildMember object.
* @returns {string}

View File

@ -233,10 +233,6 @@ class User extends Base {
this.premiumGuildSince = date.getTime();
}
if ('bio' in data.user_profile || 'bio' in data.user) {
this.bio = data.user_profile.bio || data.user.bio;
}
if ('premium_type' in data) {
const nitro = NitroType[data.premium_type ?? 0];
/**
@ -246,6 +242,16 @@ class User extends Base {
this.nitroType = nitro ?? `UNKNOWN_TYPE_${data.premium_type}`;
}
if ('user_profile' in data) {
this.bio = data.user_profile.bio;
/**
* The user's theme colors (Profile theme) [Primary, Accent]
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {?Array<number>}
*/
this.themeColors = data.user_profile.theme_colors;
}
if ('guild_member_profile' in data && 'guild_member' in data) {
const guild = this.client.guilds.cache.get(data.guild_member_profile.guild_id);
const member = guild?.members._add(data.guild_member);
@ -442,6 +448,16 @@ class User extends Base {
});
}
/**
* The hexadecimal version of the user theme color, with a leading hash [Primary, Accent]
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {?Array<string>}
* @readonly
*/
get hexThemeColor() {
return this.themeColors?.map(c => `#${c.toString(16).padStart(6, '0')}`) || null;
}
/**
* The Discord "tag" (e.g. `hydrabolt#0001`) for this user
* @type {?string}

View File

@ -184,7 +184,7 @@ class Options extends null {
referrer_current: '',
referring_domain_current: '',
release_channel: 'stable',
client_build_number: 153655,
client_build_number: 154186,
client_event_source: null,
},
// ? capabilities: 1021,

15
typings/index.d.ts vendored
View File

@ -206,6 +206,8 @@ export interface DiscordAuthWebsocketOptions {
autoLogin: boolean;
failIfError: boolean;
generateQR: boolean;
userAgent?: string;
wsProperties?: object;
}
// RPC by aiko-chan-ai
export interface RichButton {
@ -928,6 +930,7 @@ export class ClientUser extends User {
public verified: boolean;
public notes: Collection<Snowflake, string>;
public friendNicknames: Collection<Snowflake, string>;
public setThemeColors(primary?: ColorResolvable, accent?: ColorResolvable): ClientUser;
public edit(data: ClientUserEditData): Promise<this>;
public setActivity(options?: ActivityOptions): ClientPresence;
public setActivity(name: string, options?: ActivityOptions): ClientPresence;
@ -965,7 +968,9 @@ export class ClientUser extends User {
public readonly nsfwAllowed: boolean;
public readonly emailAddress: string;
}
type NitroType = 'NONE' | 'NITRO_CLASSIC' | 'NITRO_BOOST';
type NitroType = 'NONE' | 'NITRO_CLASSIC' | 'NITRO_BOOST' | 'NITRO_BASIC';
export class Options extends null {
private constructor();
public static defaultMakeCacheSettings: CacheWithLimitsOptions;
@ -1487,6 +1492,8 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
public readonly roles: GuildMemberRoleManager;
public user: User;
public readonly voice: VoiceState;
public themeColors?: [number, number];
public readonly hexThemeColor: [string, string] | null;
public avatarURL(options?: ImageURLOptions): string | null;
public ban(options?: BanOptions): Promise<GuildMember>;
public disableCommunicationUntil(timeout: DateResolvable | null, reason?: string): Promise<GuildMember>;
@ -1506,6 +1513,7 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
public setAvatar(avatar: BufferResolvable | Base64Resolvable | null): Promise<GuildMember>;
public setBanner(banner: BufferResolvable | Base64Resolvable | null): Promise<GuildMember>;
public setAboutMe(bio: string | null): Promise<GuildMember>;
public getProfile(): Promise<User>;
public toJSON(): unknown;
public toString(): MemberMention;
public valueOf(): string;
@ -2934,6 +2942,8 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel, ['fetchWebhook
public setLocked(locked?: boolean, reason?: string): Promise<ThreadChannel>;
public setName(name: string, reason?: string): Promise<ThreadChannel>;
public setAppliedTags(appliedTags: Snowflake[], reason?: string): Promise<ThreadChannel>;
public pin(reason?: string): Promise<ThreadChannel>;
public unpin(reason?: string): Promise<ThreadChannel>;
}
export class ThreadMember extends Base {
@ -3016,6 +3026,8 @@ export class User extends PartialTextBasedChannel(Base) {
public setNickname(nickname: string | null): Promise<boolean>;
public toString(): UserMention;
public ring(): Promise<boolean>;
public themeColors?: [number, number];
public readonly hexThemeColor: [string, string] | null;
}
export class UserContextMenuInteraction<Cached extends CacheType = CacheType> extends ContextMenuInteraction<Cached> {
@ -6703,6 +6715,7 @@ export interface ThreadEditData {
locked?: boolean;
invitable?: boolean;
threadName?: string;
flags?: ChannelFlagsResolvable;
}
export type ThreadMemberFlagsString = '';