mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
Send leave messages to system channel.
This commit is contained in:
@@ -47,6 +47,17 @@ client.on('ready', () => {
|
||||
}, 60000);
|
||||
});
|
||||
|
||||
client.on('guildMemberRemove', async member => {
|
||||
const channel = member.guild.systemChannel;
|
||||
if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return null;
|
||||
try {
|
||||
await channel.send(`**${member.user.tag}** bailed on us...`);
|
||||
return null;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
client.on('disconnect', event => {
|
||||
client.logger.error(`[DISCONNECT] Disconnected with code ${event.code}.`);
|
||||
process.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user