`guildCreate` event doesn't give the discord user ID who added a bot inside guild except super admin

When the guildCreate event is triggered, I am only able to retrieve the ownerId of the guild. However, when a moderator adds the guild, the moderator's ID is not provided. Is there a method available to obtain the Discord user ID of that particular moderator?
client.on('guildCreate', (guild) => {
console.log(guild.ownerId) // returned only owner discord id
});
client.on('guildCreate', (guild) => {
console.log(guild.ownerId) // returned only owner discord id
});
v14.3.0
6 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
treble/luna
treble/luna12mo ago
do you want to get the id of the person that added the bot?
fahimfaisaal
fahimfaisaal12mo ago
yes
treble/luna
treble/luna12mo ago
thats not passed in the guildCreate event, you'll have to use auditlogs
fahimfaisaal
fahimfaisaal12mo ago
Could you please share an example of that?
d.js docs
d.js docs12mo ago
guide Popular Topics: Working with Audit Logs read more