Getting Banner URL

GIST: https://gist.github.com/KiraKenjiro/de1460359c1b33dc5f2d55763eae95a2
let bannerURL = user.bannerURL({ format: "png", dynamic: true });
let isAnimatedBanner = bannerURL && typeof bannerURL === "string" && bannerURL.includes(".gif");
let bannerURL = user.bannerURL({ format: "png", dynamic: true });
let isAnimatedBanner = bannerURL && typeof bannerURL === "string" && bannerURL.includes(".gif");
That code returns this value,
bannerURL: undefined,
isAnimatedBanner: undefined,
bannerURL: undefined,
isAnimatedBanner: undefined,
Is there something i'm doing wrong to get the banner?
Gist
This is a Discord bot designed to easily retrieve your account deta...
This is a Discord bot designed to easily retrieve your account details using your ID. - index.js
8 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Danial
Danial8mo ago
You need to force fetch the user
Kiɾʌ Kenjiɾø
Ohh, okay lemme give that a shot! ^^
d.js docs
d.js docs8mo ago
method UserManager#fetch() Obtains a user from Discord, or the user cache if it's already method User#fetch() Fetches this user.
Kiɾʌ Kenjiɾø
I'm using this and it still doesn’t get the url
let bannerURL = await client.users.fetch(userID).then(user => user.bannerURL({ format: "png", dynamic: true }));
let bannerURL = await client.users.fetch(userID).then(user => user.bannerURL({ format: "png", dynamic: true }));
I feel like im doing something wrong here xD
Danial
Danial8mo ago
.fetch(userID, { force: true })
Kiɾʌ Kenjiɾø
oh you have to include the tag okay, got it <3 thanks dan
Danial
Danial8mo ago
Of course