when people add/remove bot

This commit is contained in:
loicbersier 2019-01-01 08:32:29 +01:00
parent b821dbb390
commit 30fd908444
2 changed files with 60 additions and 0 deletions

30
listeners/guildCreate.js Normal file
View file

@ -0,0 +1,30 @@
const { Listener } = require('discord-akairo');
const { statsChannel } = require('./config.json');
class guildCreateListener extends Listener {
constructor() {
super('guildCreate', {
emitter: 'client',
eventName: 'guildCreate'
});
}
async exec(message) {
client.on("guildCreate", async guild => {
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`);
const channel = client.channels.get(statsChannel);
const addEmbed = new Discord.RichEmbed()
.setColor("#52e80d")
.setTitle('Someone added me ! YAY :D')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
.setThumbnail(guild.iconURL)
.setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`)
.setTimestamp()
channel.send({ embed: addEmbed });
})
}
}
module.exports = guildCreateListener;

30
listeners/guildDelete.js Normal file
View file

@ -0,0 +1,30 @@
const { Listener } = require('discord-akairo');
const { statsChannel } = require('./config.json');
class guildCreateListener extends Listener {
constructor() {
super('guildDelete', {
emitter: 'client',
eventName: 'guildDelete'
});
}
async exec(message) {
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 = client.channels.get(statsChannel);
const kickEmbed = new Discord.RichEmbed()
.setColor("#FF0000")
.setTitle('They kicked me out :(')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
.setThumbnail(guild.iconURL)
.setDescription(`${guild.name}\n${guild.id}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\n(${guild.owner.id})`)
.setTimestamp()
channel.send({ embed: kickEmbed });
console.log('***BOT KICKED***')
}
}
module.exports = guildCreateListener;