mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
make default avatar resolving better (#1484)
* Update Constants.js * Update User.js * Update Constants.js * Update Constants.js
This commit is contained in:
@@ -124,9 +124,7 @@ class User {
|
||||
* @readonly
|
||||
*/
|
||||
get defaultAvatarURL() {
|
||||
const avatars = Object.keys(Constants.DefaultAvatars);
|
||||
const avatar = avatars[this.discriminator % avatars.length];
|
||||
return Constants.Endpoints.CDN(this.client.options.http.host).Asset(`${Constants.DefaultAvatars[avatar]}.png`);
|
||||
return Constants.Endpoints.CDN(this.client.options.http.host).DefaultAvatar(this.discriminator % 5);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -205,6 +205,7 @@ const Endpoints = exports.Endpoints = {
|
||||
return {
|
||||
Emoji: emojiID => `${root}/emojis/${emojiID}.png`,
|
||||
Asset: name => `${root}/assets/${name}`,
|
||||
DefaultAvatar: number => `${root}/embed/avatars/${number}.png`,
|
||||
Avatar: (userID, hash, format = 'default', size) => {
|
||||
if (format === 'default') format = hash.startsWith('a_') ? 'gif' : 'webp';
|
||||
if (!AllowedImageFormats.includes(format)) throw new Error(`Invalid image format: ${format}`);
|
||||
@@ -451,14 +452,6 @@ exports.MessageTypes = [
|
||||
'GUILD_MEMBER_JOIN',
|
||||
];
|
||||
|
||||
exports.DefaultAvatars = {
|
||||
BLURPLE: '6debd47ed13483642cf09e832ed0bc1b',
|
||||
GREY: '322c936a8c8be1b803cd94861bdfa868',
|
||||
GREEN: 'dd4dbc0016779df1378e7812eabaa04d',
|
||||
ORANGE: '0e291f67c9274a1abdddeb3fd919cbaa',
|
||||
RED: '1cbd08c76f8af6dddce02c5138971129',
|
||||
};
|
||||
|
||||
exports.ExplicitContentFilterTypes = [
|
||||
'DISABLED',
|
||||
'NON_FRIENDS',
|
||||
|
||||
Reference in New Issue
Block a user