Have locked channels that show live Bot and/or Member counts! You will be asked for you server ID for the Environment Variable. Create 2 voice channels that noone can connect to but can see, then replace CHANNEL_ID_HERE with their IDs on line 3 and 4. The Channels will, by default, update every 8 hours.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let humanChannelId = `CHANNEL_ID_HERE`;
let botChannelId = `CHANNEL_ID_HERE`;
let serverInfo = await lib.discord.guilds['@0.1.1'].retrieve({
guild_id: `${process.env.guildID}`,
with_counts: true,
});
let members = await lib.discord.guilds['@0.0.6'].members.list({
guild_id: `${process.env.guildID}`,
limit: 1000,
});
const bot = members.filter((x) => x.user.bot);
let humans = Number(serverInfo.approximate_member_count) - bot.length;
try {
await lib.discord.channels['@0.2.1'].update({
channel_id: `${humanChannelId}`,
name: `${humans} Members`,
});
} catch (e) {
console.log(`ERROR: updating Human channel failed. Check the id provided is correct. If you only want the Bot counter, then ignore this error.`);
}
try {
await lib.discord.channels['@0.2.1'].update({
channel_id: `${botChannelId}`,
name: `${bot.length} Bots`,
});
} catch (e) {
console.log(`ERROR: updating Bot channel failed. Check the id provided is correct. If you only want the Human counter, the ignore this error.`);
}
//MeltedButter#9266