Haha-Yes/event/listeners/guildCreate.js

35 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-01-01 08:32:29 +01:00
const { Listener } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
2019-01-10 09:00:30 +01:00
const { statsChannel } = require('../../config.json');
2019-01-01 08:32:29 +01:00
class guildCreateListener extends Listener {
2019-01-02 08:09:45 +01:00
constructor() {
super('guildCreate', {
emitter: 'client',
2019-01-02 21:46:12 +01:00
event: 'guildCreate'
2019-01-02 08:09:45 +01:00
});
}
2019-01-01 08:32:29 +01:00
2019-01-02 08:09:45 +01:00
async exec(guild) {
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`);
const channel = this.client.channels.get(statsChannel);
const addEmbed = new MessageEmbed()
2019-01-02 08:09:45 +01:00
.setColor('#52e80d')
.setTitle('New boiz in town')
2019-01-02 08:09:45 +01:00
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
.setThumbnail(guild.iconURL())
.addField('Guild name', guild.name, true)
.addField('Guild ID', guild.id, true)
.addField('Total numbers of members', guild.memberCount, true)
.addField('Number of users', guild.members.filter(member => !member.user.bot).size, true)
.addField('Numbers of bot', guild.members.filter(member => member.user.bot).size, true)
.addField('Owner', guild.owner.user.username, true)
2019-04-01 00:47:37 +02:00
.addField('Owner ID', guild.owner.id, true)
.setFooter(`Im now in ${this.client.guilds.size} servers!`)
2019-01-02 08:09:45 +01:00
.setTimestamp();
channel.send({ embed: addEmbed });
}
2019-01-01 08:32:29 +01:00
}
module.exports = guildCreateListener;