DM a guild owner if the Bot does not have the correct perms when it joins a guild on guildCreate

return guild.ownerId.send({ embeds: [createError ]}); this doesn't work. I am not sure why
13 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
chewie
chewie2y ago
of course it doesnt work, a string doesn't have a send method
d.js docs
d.js docs2y ago
method Guild#fetchOwner() Fetches the owner of the guild. If the member object isn't needed, use Guild#ownerId instead.
PAdventures
PAdventuresOP2y ago
return guild.fetchOwner().send({ embeds: [createError ]}); so is this better? or do i need to do fetchOwner().id
CanineData
CanineData2y ago
You need to resolve the promise
Syjalo
Syjalo2y ago
fetchOwner() returns a Promise
PAdventures
PAdventuresOP2y ago
so fetchOwner(id)?
d.js docs
d.js docs2y ago
Tag suggestion for @padventures: Resources to understand Promise: • MDN: learn more • Guide: learn more • JavaScript info: learn more
PAdventures
PAdventuresOP2y ago
const owner = await guild.fetchOwner()
return owner.send({ embeds: [createError ]});
const owner = await guild.fetchOwner()
return owner.send({ embeds: [createError ]});
would this work?
Jaworek
Jaworek2y ago
if u deconstructed fetchOwner yup
PAdventures
PAdventuresOP2y ago
deconstructed?
d.js docs
d.js docs2y ago
mdn Destructuring assignment The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
PAdventures
PAdventuresOP2y ago
ok well it does work ill look at deconstructing things then oh i get it thanks everyone 🙂
Want results from more Discord servers?
Add your server