bot.onLeave
An event that gets executed, if the bot sees a user leaving a server. To let the bot listen to the event, add one bot.onLeave() callback inside your mainfile.
This callback that allows the bot to log every user who leaves the server.
1
bot.leaveCommand({ //command
2
channel: "channel id", //channel where the bot logs
3
code: `your code` //Message sent to <channel>
4
})
Copied!
Make sure the <channel> is in the server. So recommended to use server variables (if your bot isn't for 1 server)
1
bot.leaveCommand({
2
channel: "782446718704812032",
3
code: `Goodbye, $username, hope you had a good stay at $serverName`
4
/*
5
Code Breakdown
6
$serverName - The name of the server the user left
7
$username - The user who left the server
8
*/
9
})
Copied!
GUILD_MEMBERS intent needed! Information in the Gateway Intents guide.
You can use all guild and member based functions like $serverName or $guildID or $username or $authorID in these commands.
Last modified 1mo ago
Copy link
Edit on GitHub