Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Add a membercount command
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Ray committed Oct 13, 2018
1 parent 69785af commit e611e20
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions commands/membercount.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const Discord = require('discord.js');

exports.run = (client, message) => {
function checkBots(guild) {
let botCount = 0;
guild.members.forEach(member => {
if (member.user.bot) botCount++;
});
return botCount;
}
function checkMembers(guild) {
let memberCount = 0;
guild.members.forEach(member => {
if (!member.user.bot) memberCount++;
});
return memberCount;
}


const embed = new Discord.RichEmbed();
embed.setAuthor(client.user.username, client.user.avatarURL);
embed.setTitle('Server Membercount');
embed.addField('Total Members', message.guild.memberCount, true);
embed.addField('Humans', checkMembers(message.guild), true);
embed.addField('Bots', checkBots(message.guild), true);
message.guild.fetchBans()
.then(bans => embed.addField('Bans', `${bans.size}`));
embed.setTimestamp();
embed.setFooter(`${client.user.username} | Server ID: ${message.guild.id}`);
message.channel.send(embed);

};

exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 'Standard User'
};

exports.help = {
name: 'membercount',
category: 'Moderation',
description: 'Shows a full membercount.',
usage: 'membercount'
};

0 comments on commit e611e20

Please sign in to comment.