Log to console when added or removed from servers

This commit is contained in:
Marius Begby committed 2023-07-06 12:24:46 +02:00
1 parent c1411fb7e5
commit 13e27e4f0f
1 file changed
+15 -1
+15 -1
View File
@@ -42,7 +42,9 @@ client.once('ready', async () => {
});
// Show how many guilds the bot is added to
console.log(`Info: ${client.user.tag} is currently added in ${client.guilds.cache.size} guilds!`);
console.log(
`Info: ${client.user.tag} is currently added in ${client.guilds.cache.size} guilds!`
);
});
client.once('reconnecting', () => {
@@ -59,6 +61,18 @@ client.on('warn', (info) => {
client.on('error', console.error);
client.on('guildCreate', (guild) => {
console.log(
`Info: ${client.user.tag} has been added to server '${guild.name}'!`
);
});
client.on('guildDelete', (guild) => {
console.log(
`Info: ${client.user.tag} was removed from server '${guild.name}'!`
);
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) {
return;