Reputation: 3
my code:
if(message.content == prefix + "dev"){
const owner = client.users.fetch('462223589043863562');
console.log(owner.user);
console.log(owner.id);
console.log(owner);
message.channel.send(`eggy is the dev of this chad ass bot. Discord: ${owner}`);
logs:
undefined
undefined
Promise {
User {
id: '462223589043863562',
system: false,
locale: null,
flags: UserFlags { bitfield: 64 },
username: 'eggyy',
bot: false,
discriminator: '0001',
avatar: 'a_de18cc5553a2fd2e5fbd3d3e3491595b',
lastMessageID: '865041520075735040',
lastMessageChannelID: '864827452063875125'
}
}
Also, when doing owner.Promise.User.user it gives an error: TypeError: Cannot read property 'User' of undefined.
Upvotes: 0
Views: 526
Reputation: 448
<client>.users.fetch()
returns a promise which you can handle simply by using await
. Therefore, in order to resolve it, you can just replace your current owner
definition with const owner = client.users.fetch('462223589043863562');
.
However, if you are going to use await
, you must make your present function async
(e.g. client.on('message', async message => {})
.
Upvotes: 1