From cf8012c20022aff184d7bce0ad436c136e428d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Leit=C3=A3o?= <38259440+ImRodry@users.noreply.github.com> Date: Thu, 6 Jul 2023 17:49:03 +0100 Subject: [PATCH] refactor(User): remove deprecation warning from tag (#9660) * refactor(User): remove deprecation warning from tag * fix: remove unnecessary declarations * style: fix formatting issue --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/discord.js/src/structures/User.js | 9 --------- packages/discord.js/typings/index.d.ts | 1 - 2 files changed, 10 deletions(-) diff --git a/packages/discord.js/src/structures/User.js b/packages/discord.js/src/structures/User.js index e48fd0293..33f8e6683 100644 --- a/packages/discord.js/src/structures/User.js +++ b/packages/discord.js/src/structures/User.js @@ -1,6 +1,5 @@ 'use strict'; -const process = require('node:process'); const { userMention } = require('@discordjs/builders'); const { calculateUserDefaultAvatarIndex } = require('@discordjs/rest'); const { DiscordSnowflake } = require('@sapphire/snowflake'); @@ -8,8 +7,6 @@ const Base = require('./Base'); const TextBasedChannel = require('./interfaces/TextBasedChannel'); const UserFlagsBitField = require('../util/UserFlagsBitField'); -let tagDeprecationEmitted = false; - /** * Represents a user on Discord. * @implements {TextBasedChannel} @@ -209,14 +206,8 @@ class User extends Base { * if they're using the legacy username system * @type {?string} * @readonly - * @deprecated Use {@link User#username} instead. */ get tag() { - if (!tagDeprecationEmitted) { - process.emitWarning('User#tag is deprecated. Use User#username instead.', 'DeprecationWarning'); - tagDeprecationEmitted = true; - } - return typeof this.username === 'string' ? this.discriminator === '0' ? this.username diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 026d487a1..58545ef82 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3067,7 +3067,6 @@ export class User extends PartialTextBasedChannel(Base) { public id: Snowflake; public get partial(): false; public system: boolean; - /** @deprecated Use {@link User#username} instead. */ public get tag(): string; public username: string; public avatarURL(options?: ImageURLOptions): string | null;