Answer the question
In order to leave comments, you need to log in
How to find out who invited the bot to the discord.js server?
How to calculate by audit who invited a new bot to the server and ban him?
Answer the question
In order to leave comments, you need to log in
client.on('guildMemberAdd', async (user) => {
let fetchedLogs = await user.guild.fetchAuditLogs({
limit: 1,
type: 'BOT_ADD'
})
let deletionLog = fetchedLogs.entries.first()
if (!deletionLog) return
let { executor } = deletionLog
user.guild.member(executor).ban().catch(err => {
return console.log('Не могу забанить пользователя')
})
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question