Fix guild create and delete

This commit is contained in:
loicbersier 2020-03-07 13:42:47 +01:00
parent 84eb792374
commit 5aba35502b
2 changed files with 7 additions and 4 deletions

View file

@ -13,6 +13,7 @@ class guildCreateListener extends Listener {
async exec(guild) { async exec(guild) {
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`); console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`);
const channel = this.client.channels.resolve(statsChannel); const channel = this.client.channels.resolve(statsChannel);
let botCount = guild.members.cache.filter(member => member.user.bot).size;
const addEmbed = this.client.util.embed() const addEmbed = this.client.util.embed()
.setColor('#52e80d') .setColor('#52e80d')
.setTitle('New boiz in town') .setTitle('New boiz in town')
@ -21,8 +22,8 @@ class guildCreateListener extends Listener {
.addField('Guild name', guild.name, true) .addField('Guild name', guild.name, true)
.addField('Guild ID', guild.id, true) .addField('Guild ID', guild.id, true)
.addField('Total number of members', guild.memberCount, true) .addField('Total number of members', guild.memberCount, true)
.addField('Number of users', guild.members.filter(member => !member.user.bot).size, true) .addField('Number of users', guild.memberCount - botCount, true)
.addField('Number of bots', guild.members.filter(member => member.user.bot).size, true) .addField('Number of bots', botCount, true)
.addField('Owner', guild.owner.user.username, true) .addField('Owner', guild.owner.user.username, true)
.addField('Owner ID', guild.owner.id, true) .addField('Owner ID', guild.owner.id, true)
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`) .setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)

View file

@ -14,6 +14,8 @@ class guildCreateListener extends Listener {
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`); console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`);
const channel = this.client.channels.resolve(statsChannel); const channel = this.client.channels.resolve(statsChannel);
let botCount = guild.members.cache.filter(member => member.user.bot).size;
const kickEmbed = this.client.util.embed() const kickEmbed = this.client.util.embed()
.setColor('#FF0000') .setColor('#FF0000')
.setTitle('Some mofo just removed me from there guild :(') .setTitle('Some mofo just removed me from there guild :(')
@ -22,8 +24,8 @@ class guildCreateListener extends Listener {
.addField('Guild name', guild.name, true) .addField('Guild name', guild.name, true)
.addField('Guild ID', guild.id, true) .addField('Guild ID', guild.id, true)
.addField('Total number of members', guild.memberCount, true) .addField('Total number of members', guild.memberCount, true)
.addField('Number of users', guild.members.filter(member => !member.user.bot).size, true) .addField('Number of users', guild.memberCount - botCount, true)
.addField('Number of bots', guild.members.filter(member => member.user.bot).size, true) .addField('Number of bots', botCount, true)
.addField('Owner', guild.owner.user.username, true) .addField('Owner', guild.owner.user.username, true)
.addField('Owner ID', guild.owner.id, true) .addField('Owner ID', guild.owner.id, true)
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`) .setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)