Skip to content

Commit 154b1d8

Browse files
committed
refactor: name approach
1 parent 925398f commit 154b1d8

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

packages/discord.js/src/managers/UserManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class UserManager extends CachedManager {
105105
* Flags may still be retrieved via {@link UserManager#fetch}.</warn>
106106
*/
107107
async fetchFlags(user, options) {
108-
emitDeprecationWarningForUserFetchFlags(true);
108+
emitDeprecationWarningForUserFetchFlags(this.constructor.name);
109109
return (await this.fetch(user, options)).flags;
110110
}
111111

packages/discord.js/src/structures/User.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class User extends Base {
351351
* Flags may still be retrieved via {@link User#fetch}.</warn>
352352
*/
353353
fetchFlags(force = false) {
354-
emitDeprecationWarningForUserFetchFlags(false);
354+
emitDeprecationWarningForUserFetchFlags(this.constructor.name);
355355
return this.client.users.fetchFlags(this.id, { force });
356356
}
357357

packages/discord.js/src/util/Util.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,11 @@ function resolveSKUId(resolvable) {
504504

505505
/**
506506
* Deprecation function for fetching user flags.
507-
* @param {boolean} userManager Whether the class name is the user manager
507+
* @param {string} name Name of the class
508508
* @private
509509
*/
510-
function emitDeprecationWarningForUserFetchFlags(userManager) {
510+
function emitDeprecationWarningForUserFetchFlags(name) {
511511
if (deprecationEmittedForUserFetchFlags) return;
512-
const name = userManager ? 'UserManager' : 'User';
513512
process.emitWarning(`${name}#fetchFlags() is deprecated. Use ${name}#fetch() instead.`);
514513
deprecationEmittedForUserFetchFlags = true;
515514
}

0 commit comments

Comments
 (0)