refactor(User): remove deprecation warning from tag

#9660 djs
This commit is contained in:
Elysia 2023-07-11 11:56:20 +07:00
parent 9e7be09c6f
commit 6dea9bb096
2 changed files with 0 additions and 9 deletions

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const process = require('node:process');
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
const Base = require('./Base'); const Base = require('./Base');
const ClientApplication = require('./ClientApplication'); const ClientApplication = require('./ClientApplication');
@ -12,8 +11,6 @@ const SnowflakeUtil = require('../util/SnowflakeUtil');
const UserFlags = require('../util/UserFlags'); const UserFlags = require('../util/UserFlags');
const Util = require('../util/Util'); const Util = require('../util/Util');
let tagDeprecationEmitted = false;
/** /**
* Represents a user on Discord. * Represents a user on Discord.
* @implements {TextBasedChannel} * @implements {TextBasedChannel}
@ -555,14 +552,9 @@ class User extends Base {
* <info>This user's username, or their legacy tag (e.g. `hydrabolt#0001`) * <info>This user's username, or their legacy tag (e.g. `hydrabolt#0001`)
* if they're using the legacy username system</info> * if they're using the legacy username system</info>
* @type {?string} * @type {?string}
* @deprecated Use {@link User#username} instead.
* @readonly * @readonly
*/ */
get tag() { get tag() {
if (!tagDeprecationEmitted) {
process.emitWarning('User#tag is deprecated. Use User#username instead.', 'DeprecationWarning');
tagDeprecationEmitted = true;
}
return typeof this.username === 'string' return typeof this.username === 'string'
? this.discriminator === '0' ? this.discriminator === '0'
? this.username ? this.username

1
typings/index.d.ts vendored
View File

@ -3273,7 +3273,6 @@ export class User extends PartialTextBasedChannel(Base) {
public id: Snowflake; public id: Snowflake;
public readonly partial: false; public readonly partial: false;
public system: boolean; public system: boolean;
/** @deprecated Use {@link User#username} instead. */
public readonly tag: string; public readonly tag: string;
public username: string; public username: string;
public readonly note: string | null; public readonly note: string | null;