mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix: Ensure discriminator detection respects webhooks too (#11062)
* Replace discriminator === '0' to Number(discriminator) * Fix * Replacing !Number() to ['0', '0000'].includes * chore: fmt * perf: no array --------- Co-authored-by: almeidx <github@almeidx.dev> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -267,7 +267,11 @@ class User extends Base {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get defaultAvatarURL() {
|
get defaultAvatarURL() {
|
||||||
const index = this.discriminator === '0' ? calculateUserDefaultAvatarIndex(this.id) : this.discriminator % 5;
|
const index =
|
||||||
|
this.discriminator === '0' || this.discriminator === '0000'
|
||||||
|
? calculateUserDefaultAvatarIndex(this.id)
|
||||||
|
: this.discriminator % 5;
|
||||||
|
|
||||||
return this.client.rest.cdn.defaultAvatar(index);
|
return this.client.rest.cdn.defaultAvatar(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +326,7 @@ class User extends Base {
|
|||||||
*/
|
*/
|
||||||
get tag() {
|
get tag() {
|
||||||
return typeof this.username === 'string'
|
return typeof this.username === 'string'
|
||||||
? this.discriminator === '0'
|
? this.discriminator === '0' || this.discriminator === '0000'
|
||||||
? this.username
|
? this.username
|
||||||
: `${this.username}#${this.discriminator}`
|
: `${this.username}#${this.discriminator}`
|
||||||
: null;
|
: null;
|
||||||
|
|||||||
Reference in New Issue
Block a user