woomy/events/guildDelete.js

22 lines
651 B
JavaScript
Raw Normal View History

2020-04-04 09:16:05 +00:00
const Discord = require('discord.js')
module.exports = async (client, guild) => {
if (!guild.available) return
client.logger.info('Guild left.')
// Delete this guild's data from our database
try {
await client.deleteGuild(guild)
} catch (err) {
client.logger.error('Failed to delete DB entry for guild: ' + err)
}
if (client.devmode === false) {
const channel = client.channels.cache.get(client.config.support.serverLogs)
const embed = new Discord.MessageEmbed()
embed.setColor('#9494FF')
embed.setDescription(`Left a server. I'm now in \`${client.guilds.cache.size}\` servers.`)
channel.send(embed)
}
}