Currently, I am in the midst of developing a discord bot using discord.js. When attempting to retrieve the target user, I utilize the following code:
let target = message.guild.members.fetch(id)
. This method yields either Promise { <pending> }
if the user has not sent any messages after the bot's restart or Promise { GuildMember: {information} }
if the user had interacted with the bot previously. My goal is to access the user's information when it is no longer pending.
I have experimented with the following approach:
let target = message.guild.members.fetch(id).then(console.log(target)
Despite my attempts and trying some other methods, I find myself struggling to comprehend the concept of Promise
.
If anyone could provide guidance, it would be greatly appreciated.