Skip to content

Commit

Permalink
refactor(User): remove deprecation warning from tag (#9660)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
ImRodry and kodiakhq[bot] authored Jul 6, 2023
1 parent 0803eb5 commit cf8012c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
9 changes: 0 additions & 9 deletions packages/discord.js/src/structures/User.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
'use strict';

const process = require('node:process');
const { userMention } = require('@discordjs/builders');
const { calculateUserDefaultAvatarIndex } = require('@discordjs/rest');
const { DiscordSnowflake } = require('@sapphire/snowflake');
const Base = require('./Base');
const TextBasedChannel = require('./interfaces/TextBasedChannel');
const UserFlagsBitField = require('../util/UserFlagsBitField');

let tagDeprecationEmitted = false;

/**
* Represents a user on Discord.
* @implements {TextBasedChannel}
Expand Down Expand Up @@ -209,14 +206,8 @@ class User extends Base {
* if they're using the legacy username system</info>
* @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
Expand Down
1 change: 0 additions & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cf8012c

Please sign in to comment.