Send a message on guild join

This commit is contained in:
Dragon Fire
2020-07-07 17:10:34 -04:00
parent 1d2ae54f2b
commit 98a8aba9b8
8 changed files with 22 additions and 10 deletions
+10
View File
@@ -114,6 +114,16 @@ client.on('message', async msg => {
}
});
client.on('guildCreate', async guild => {
if (!guild.systemChannel || !guild.systemChannel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
try {
const usage = client.registry.commands.get('help').usage();
await guild.systemChannel.send(`Hi! I'm Xiao, use ${usage} to see my commands, yes?`);
} catch {
return; // eslint-disable-line no-useless-return
}
});
client.on('guildMemberRemove', async member => {
if (member.id === client.user.id) return null;
const channel = member.guild.systemChannel;