nightlxight
nightlxight

Reputation: 3

How to get owner of a guild in discord.js v13?

In discord.js v12, message.guild.owner works but in discord.js v13, interaction.guild.owner does not work. How do I get owner of guild? I don't see interaction.guild.owner in docs. Anybody can help?

Upvotes: 0

Views: 6160

Answers (2)

Zero
Zero

Reputation: 2286

The docs are always the best place to look for! You may first get the interaction.guild for the GuildObject and further use the .fetchOwner() method on it, which returns us a promise with when fulfilled returns us the GuildMember object of the owner.

Upvotes: 1

MrMythical
MrMythical

Reputation: 9041

The Guild.fetchOwner method fetches the owner from the API and always returns the owner.

//...
let owner = await interaction.guild.fetchOwner()
console.log(owner)
//...

Upvotes: 3

Related Questions