Fix minor bug
- TypeError: this.client.rest.cdn.avatar is not a function - ReferenceError: AllowedImageFormats is not defined
This commit is contained in:
parent
e8b87a1778
commit
6f6c986fd2
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord.js-selfbot-v13",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
|
||||
"main": "./src/index.js",
|
||||
"types": "./typings/index.d.ts",
|
||||
|
@ -127,7 +127,8 @@ class User extends Base {
|
||||
_ProfilePatch(data) {
|
||||
if (!data) return;
|
||||
|
||||
if(data.connected_accounts.length > 0) this.connectedAccounds = data.connected_accounts;
|
||||
if (data.connected_accounts.length > 0)
|
||||
this.connectedAccounds = data.connected_accounts;
|
||||
|
||||
if ('premium_since' in data) {
|
||||
const date = new Date(data.premium_since);
|
||||
@ -139,7 +140,9 @@ class User extends Base {
|
||||
this.premiumGuildSince = date.getTime();
|
||||
}
|
||||
|
||||
this.mutualGuilds = new Collection(data.mutual_guilds.map((obj) => [obj.id, obj]));
|
||||
this.mutualGuilds = new Collection(
|
||||
data.mutual_guilds.map((obj) => [obj.id, obj]),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,9 +154,9 @@ class User extends Base {
|
||||
try {
|
||||
const data = await this.client.api.users(this.id).profile.get();
|
||||
this._ProfilePatch(data);
|
||||
return this
|
||||
return this;
|
||||
} catch (e) {
|
||||
throw e
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +194,7 @@ class User extends Base {
|
||||
return this.client.api
|
||||
.users('@me')
|
||||
.relationships[this.id].put({ data: { type: 2 } })
|
||||
.then(_ => _)
|
||||
.then((_) => _);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,8 +204,7 @@ class User extends Base {
|
||||
async unBlock() {
|
||||
return this.client.api
|
||||
.users('@me')
|
||||
.relationships[this.id].delete
|
||||
.then(_ => _)
|
||||
.relationships[this.id].delete.then((_) => _);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -212,8 +214,7 @@ class User extends Base {
|
||||
async unFriend() {
|
||||
return this.client.api
|
||||
.users('@me')
|
||||
.relationships[this.id].delete
|
||||
.then(_ => _)
|
||||
.relationships[this.id].delete.then((_) => _);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -248,8 +249,15 @@ class User extends Base {
|
||||
* @param {ImageURLOptions} [options={}] Options for the image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
avatarURL(options = {}) {
|
||||
return this.avatar && this.client.rest.cdn.avatar(this.id, this.avatar, options);
|
||||
avatarURL({ format, size, dynamic } = {}) {
|
||||
if (!this.avatar) return null;
|
||||
return this.client.rest.cdn.Avatar(
|
||||
this.id,
|
||||
this.avatar,
|
||||
format,
|
||||
size,
|
||||
dynamic,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,7 +306,9 @@ class User extends Base {
|
||||
* @returns {?string}
|
||||
*/
|
||||
bannerURL(options = {}) {
|
||||
return this.banner && this.client.rest.cdn.banner(this.id, this.banner, options);
|
||||
return (
|
||||
this.banner && this.client.rest.cdn.banner(this.id, this.banner, options)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -307,7 +317,9 @@ class User extends Base {
|
||||
* @readonly
|
||||
*/
|
||||
get tag() {
|
||||
return typeof this.username === 'string' ? `${this.username}#${this.discriminator}` : null;
|
||||
return typeof this.username === 'string'
|
||||
? `${this.username}#${this.discriminator}`
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,6 +200,12 @@ exports.Events = {
|
||||
GUILD_SCHEDULED_EVENT_USER_REMOVE: 'guildScheduledEventUserRemove',
|
||||
};
|
||||
|
||||
const AllowedImageFormats = ['webp', 'png', 'jpg', 'jpeg', 'gif'];
|
||||
|
||||
const AllowedImageSizes = [
|
||||
16, 32, 56, 64, 96, 128, 256, 300, 512, 600, 1024, 2048, 4096,
|
||||
];
|
||||
|
||||
function makeImageUrl(root, { format = 'webp', size } = {}) {
|
||||
if (!['undefined', 'number'].includes(typeof size)) throw new TypeError('INVALID_TYPE', 'size', 'number');
|
||||
if (format && !AllowedImageFormats.includes(format)) throw new Error('IMAGE_FORMAT', format);
|
||||
|
@ -101,7 +101,7 @@ class Options extends null {
|
||||
$browser: 'Chrome',
|
||||
$device: 'ASUS ROG Phone 5',
|
||||
},
|
||||
version: 9,
|
||||
version: 10,
|
||||
},
|
||||
http: {
|
||||
headers: {
|
||||
|
Loading…
Reference in New Issue
Block a user