#user banner fetch

1 messages · Page 1 of 1 (latest)

heady quail
#

where exactly did you get "force fetch" from?

quick shoal
heady quail
#

ClientUser is your bot and bots cannot have a banner

quick shoal
#

nvm here

heady quail
#

right, user payloads don't include a banner, so you have to fetch the user once for that data to be available

#

the force option skips the cache check and ALWAYS fetches the user from the API
(usually we check the cache before hitting the API)

quick shoal
#

hmm

#

let me try

heady quail
#

user banner fetch

quick shoal
#

Do you mean like: client.users.fetch('707388753576198265')

heady quail
#

where do you get the User instance from?

quick shoal
#

do you mean 707388753576198265?

heady quail
#

do you want the banner of that specific user, or the command author or something?

quick shoal
heady quail
#

provided that user has set a banner, ofc

quick shoal
#

if they dont will it just show the color?

heady quail
#

no, that's available via a different property

quick shoal
#

which property is that?

heady quail
#

should be #accentColor

covert fernBOT
heady quail
#

-ev msg.author.fetch().then(a => a.accentColor)

north belfry
#
null
```• d.js 13.3.1 • Type: `object` • time taken: `164.425118ms`
heady quail
#

shibaThinking oh, right, i have a banner

#

-ev msg.client.users.fetch("707388753576198265").then(u => u.accentColor)

north belfry
#
undefined
```• d.js 13.3.1 • Type: `undefined` • time taken: `0.167434ms`
quick shoal
#

huh

heady quail
#

hm.

#

-ev msg.client.users.fetch("707388753576198265").then(u => u)

north belfry
#
User {
  id: '707388753576198265',
  bot: false,
  system: false,
  flags: [UserFlags],
  username: 'IANWYTIA',
  discriminator: '5895',
  avatar: 'f91c6f8f7beec58c297ca88f812672bc',
  banner: undefined,
  accentColor: undefined
}
```• d.js 13.3.1 • Type: `object` • time taken: `0.197089ms`
heady quail
#

but you have a color set, don't you?

quick shoal
#

im trying to display accent color as embed color and user banner as image

quick shoal
heady quail
#

oh, is that the one they derived from the avatar?

#

guess that's not available via the API shibaThinking

heady quail
#

did you set that manually?

quick shoal
#

this is what i found:

#

.accentColor
The base 10 accent color of the user's banner

quick shoal
heady quail
#

then the question is... why do i not get it shibaThinking

quick shoal
#

nvm, its the default

heady quail
#

that information is not something discord gives you, it seems

#

-ev msg.author.fetch()

north belfry
#
User {
  id: '83886770768314368',
  bot: false,
  system: false,
  flags: [UserFlags],
  username: 'Souji',
  discriminator: '0001',
  avatar: '5c153c8395fbe617819749da4048172f',
  banner: 'a_a9875e1da912825f5f3386cf2745f995',
  accentColor: null
}
```• d.js 13.3.1 • Type: `object` • time taken: `133.025643ms`
heady quail
#

yep

quick shoal
#

I did:

user2=interaction.options.getUser('user')||interaction.user
      user3=await client.users.fetch(user2.id)
      const embed = new MessageEmbed()
      .setColor(user3.accentColor||'#5865F2')
      .setImage(user3.bannerURL())
      await interaction.reply({embeds:[embed]});

but it keeps saying i must fetch it

heady quail
#

what you say and what you do kinda don't align...
i asked where you get the user from, so you get it from the interaction, why exactly do you say you get it via an ID then...
just user2#fetch, no need to go via client

  • though i cannot see how that wouldn't work

what do you mean by "it keeps saying"?

quick shoal
#

hmm

#

oh

#

thats what you meant

#

'it keeps saying' as in the error

#
user2=interaction.options.getUser('user')||interaction.user
user3=user2.fetch()
const embed = new MessageEmbed()
.setImage(user3.bannerURL())
await ineraction.reply(embeds:[embed])
#

"TypeError: user3.bannerURL is not a function"

heady quail
#

well... the code you JUST showed is different