diff --git a/packages/discord.js/src/structures/User.js b/packages/discord.js/src/structures/User.js index 588519053..7a302e341 100644 --- a/packages/discord.js/src/structures/User.js +++ b/packages/discord.js/src/structures/User.js @@ -2,7 +2,6 @@ const Base = require('./Base'); const TextBasedChannel = require('./interfaces/TextBasedChannel'); -const { Error } = require('../errors'); const SnowflakeUtil = require('../util/SnowflakeUtil'); const UserFlags = require('../util/UserFlags'); @@ -180,15 +179,12 @@ class User extends Base { } /** - * A link to the user's banner. - * This method will throw an error if called before the user is force fetched. - * See {@link User#banner} for more info + * A link to the user's banner. See {@link User#banner} for more info * @param {ImageURLOptions} [options={}] Options for the Image URL * @returns {?string} */ bannerURL({ format, size, dynamic } = {}) { - if (typeof this.banner === 'undefined') throw new Error('USER_BANNER_NOT_FETCHED'); - if (!this.banner) return null; + if (!this.banner) return this.banner; return this.client.rest.cdn.Banner(this.id, this.banner, format, size, dynamic); } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index c4f16ff5e..ff1f8d3cd 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2381,7 +2381,7 @@ export class User extends PartialTextBasedChannel(Base) { public readonly tag: string; public username: string; public avatarURL(options?: ImageURLOptions): string | null; - public bannerURL(options?: ImageURLOptions): string | null; + public bannerURL(options?: ImageURLOptions): string | null | undefined; public createDM(force?: boolean): Promise; public deleteDM(): Promise; public displayAvatarURL(options?: ImageURLOptions): string;