Skip to content

Instantly share code, notes, and snippets.

@acollierr17
Last active May 9, 2019 22:38
Show Gist options
  • Save acollierr17/6c705ed4b90fe5c7a73af7a0091ad6af to your computer and use it in GitHub Desktop.
Save acollierr17/6c705ed4b90fe5c7a73af7a0091ad6af to your computer and use it in GitHub Desktop.
Server Stats! Set voice channels will update whenever a new member joins/leaves the guild. Make sure to update the guild and channel IDs in the serverStats.js file. Also make sure the channels for each stat is created and you have those channel IDs in the serverStats.js file.
Posts server stats to specific voice channels!
const { guildID, totalUsersID, memberCountID, botCountID } = require('../utils/serverStats'); // change to whatever path the serverStats.js file is located
module.exports = async (client, member) => {
if (member.guild.id !== guildID) return;
client.channels.get(totalUsersID).setName(`Total Users: ${member.guild.memberCount}`);
client.channels.get(memberCountID).setName(`Members: ${member.guild.members.filter(m => !m.user.bot).size}`);
client.channels.get(botCountID).setName(`Bots: ${member.guild.members.filter(m => m.user.bot).size}`);
}
const { guildID, totalUsersID, memberCountID, botCountID } = require('../utils/serverStats'); // change to whatever path the serverStats.js file is located
module.exports = async (client, member) => {
if (member.guild.id !== guildID) return;
client.channels.get(totalUsersID).setName(`Total Users: ${member.guild.memberCount}`);
client.channels.get(memberCountID).setName(`Members: ${member.guild.members.filter(m => !m.user.bot).size}`);
client.channels.get(botCountID).setName(`Bots: ${member.guild.members.filter(m => m.user.bot).size}`);
}
module.exports = {
guildID: 'GUILD_ID', // ID for the guild/server
totalUsersID: 'TOTAL_USERS_CHANNEL_ID', // ID for the voice channel where the total users should be. By default, set this: Total: 0
memberCountID: 'MEMBERS_CHANNEL_ID', // ID for the voice channel where the member count should be. By default, set this: Members: 0
botCountID: 'BOTS_CHANNEL_ID' // ID for the voice channel where the bot count should be. By default, set this: Bots: 0
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment