Accessing .addUserOption Pfp and bot pfp
I'm currently working alongside the online guide, and I've come across an issue I couldn't find.
The current project structure contains a folder "commands", in which each file represents a command. I'm working on one file and try to obtain a target user's profile picture, as well as the bot's profile picture to display in an Embed.
While
interaction.user.displayAvatarURL()
works as expected, I can't seem to figure out how to get the same URL from interaction.options.getUser("user")
. Additionally, I don't know where I can locate the bot's profile picture to begin with. I assumed it's in the client object, but how do I access that from a separate file?
Thanks in advance.6 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Node is v16.14.2 if necessary
Client.user.displayAvatarURL()
And make sure the option name matches the name you are querying and that if the option isn't required you need to handle the user not existing
and how do I pass client to the file? Do I simply pass it as parameter in the execute method?
This is where the command is called in
index.js
wow, that is quite unreadable in this small window
command.execute(interaction)
turning into
command.execute(interaction, client)
, is that how you access client from the command file?You can get client from any structure
oh, alright. I have to test that then
well, that summed up all my questions, thanks for your help. I'll close the post now