📊 Server Stats & Metrics

Get Discord server statistics instantly with the global stats object.

⚡ Quick Start

Access server stats directly in any command using the stats object:

commands/members.js
bot.command.new('members', 'Show member count', async function() {
await this.reply(`👥 ${stats.members.all} members (${stats.members.online} online)`);
});

📈 Server Stats Command

Create a comprehensive server statistics command:

commands/serverstats.js
bot.command.new('serverstats', 'Show server statistics', async function() {
await this.reply({
embeds: [{
title: `📊 ${stats.guild.name} Statistics`,
fields: [
{
name: '👥 Members',
value: `${stats.members.all} total\n${stats.members.online} online\n${stats.members.bots} bots`,
inline: true
},
{
name: '📢 Channels',
value: `${stats.channels.all} total\n${stats.channels.text} text\n${stats.channels.voice} voice`,
inline: true
},
{
name: '🎭 Roles',
value: `${stats.roles.all} total\n${stats.roles.admin} admin`,
inline: true
},
{
name: '😀 Emojis',
value: `${stats.emojis.all}/${stats.emojis.maxSlots}\n${stats.emojis.remaining} slots left`,
inline: true
},
{
name: '💎 Boosts',
value: `Level ${stats.boost.level}\n${stats.boost.count} boosts\n${stats.boost.boosters} boosters`,
inline: true
},
{
name: '🎂 Server Age',
value: `${stats.guild.age} days old\nCreated: <t:${Math.floor(stats.guild.createdAt.getTime() / 1000)}:R>`,
inline: true
},
{
name: '🔊 Voice',
value: `${stats.voice.active} in voice\n${stats.voice.streaming} streaming`,
inline: true
},
{
name: '🆕 New Members',
value: `${stats.members.new24h} today\n${stats.members.new7d} this week`,
inline: true
},
{
name: '🎨 Stickers',
value: `${stats.stickers.all}/${stats.stickers.maxSlots}`,
inline: true
}
],
color: 0x5865F2,
timestamp: new Date()
}]
});
});

👥 Member Statistics

Track member counts, online status, and new joins.

Basic Member Info

// Total member count
stats.members.all
// Online members (online, idle, dnd)
stats.members.online
// Offline members
stats.members.offline
// Bot count
stats.members.bots
// Human count
stats.members.humans

New Members

// Joined in last 24 hours
stats.members.new24h
// Joined in last 7 days
stats.members.new7d
// Example: Welcome message for new members
on('guildMemberAdd', async (member) => {
const guild = member.guild;
const guildStats = getStats(guild);
await log(`👋 ${member.user.tag} joined! Total members: ${guildStats.members.all}`);
});

Role Status

// Members with any roles (excluding @everyone)
stats.members.withRoles
// Members without roles (only @everyone)
stats.members.withoutRoles
// Example: Check if most members have roles
bot.command.new('rolecheck', 'Check role distribution', async function() {
const withRoles = stats.members.withRoles;
const withoutRoles = stats.members.withoutRoles;
const percent = Math.round((withRoles / stats.members.all) * 100);
await this.reply(`${percent}% of members have roles (\n${withRoles} with roles, ${withoutRoles} without)`);
});

🏰 Guild Information

Access server details, owner info, and verification status.

Basic Info

// Server name
stats.guild.name
// Server ID
stats.guild.id
// Server description
stats.guild.description
// Owner ID
stats.guild.ownerId
// Owner member object
stats.guild.owner
// Example: Server info command
bot.command.new('serverinfo', 'Show server info', async function() {
const owner = stats.guild.owner;
await this.reply({
embeds: [{
title: stats.guild.name,
description: stats.guild.description || 'No description',
fields: [
{ name: 'Owner', value: `<@${stats.guild.ownerId}>`, inline: true },
{ name: 'ID', value: stats.guild.id, inline: true },
{ name: 'Age', value: `${stats.guild.age} days`, inline: true }
],
thumbnail: { url: stats.guild.icon },
color: 0x5865F2
}]
});
});

Server Age & Dates

// Server creation date
stats.guild.createdAt
// Server age in days
stats.guild.age
// Example: Calculate server milestones
bot.command.new('serverage', 'How old is the server?', async function() {
const age = stats.guild.age;
const years = Math.floor(age / 365);
const months = Math.floor((age % 365) / 30);
const days = age % 30;
await this.reply(`🎂 Server is ${years} years, ${months} months, and ${days} days old!`);
});

Verification & Status

// Is verified server
stats.guild.verified
// Is partnered server
stats.guild.partnered
// Verification level
stats.guild.verificationLevel
// Vanity URL code (if available)
stats.guild.vanityCode
// Example: Server badges
bot.command.new('badges', 'Show server badges', async function() {
const badges = [];
if (stats.guild.verified) badges.push('✅ Verified');
if (stats.guild.partnered) badges.push('🤝 Partnered');
if (stats.boost.level >= 3) badges.push('💎 Level 3 Boosted');
await this.reply(`Server badges: ${badges.join(', ') || 'None'}`);
});

Server Images

// Server icon URL (2048px)
stats.guild.icon
// Server banner URL
stats.guild.banner
// Server splash (invite background)
stats.guild.splash
// Example: Show server images
bot.command.new('serverimages', 'Show server images', async function() {
await this.reply({
embeds: [{
title: `${stats.guild.name} Images`,
image: { url: stats.guild.banner || stats.guild.icon },
thumbnail: { url: stats.guild.icon },
color: 0x5865F2
}]
});
});

📢 Channel Statistics

Track all channel types in your server.

// Total channels
stats.channels.all
// Text channels
stats.channels.text
// Voice channels
stats.channels.voice
// Categories
stats.channels.categories
// Stage channels
stats.channels.stage
// Forum channels
stats.channels.forum
// Thread channels
stats.channels.threads
// Announcement channels
stats.channels.announcement
// Example: Channel breakdown
bot.command.new('channels', 'Show channel breakdown', async function() {
await this.reply({
embeds: [{
title: '📢 Channel Breakdown',
fields: [
{ name: 'Total', value: stats.channels.all.toString(), inline: true },
{ name: 'Text', value: stats.channels.text.toString(), inline: true },
{ name: 'Voice', value: stats.channels.voice.toString(), inline: true },
{ name: 'Categories', value: stats.channels.categories.toString(), inline: true },
{ name: 'Forums', value: stats.channels.forum.toString(), inline: true },
{ name: 'Threads', value: stats.channels.threads.toString(), inline: true }
],
color: 0x5865F2
}]
});
});

🎭 Role Statistics

Access role counts and special role types.

// Total roles
stats.roles.all
// Admin roles (with Administrator permission)
stats.roles.admin
// Mentionable roles
stats.roles.mentionable
// Hoisted roles (displayed separately in member list)
stats.roles.hoisted
// Managed roles (bot roles, integrations)
stats.roles.managed
// Highest role in server
stats.roles.highest
// @everyone role
stats.roles.lowest
// Example: Role security check
bot.command.new('rolesecurity', 'Check role security', async function() {
const adminRoles = stats.roles.admin;
const managedRoles = stats.roles.managed;
await this.reply({
embeds: [{
title: '🔒 Role Security',
fields: [
{ name: 'Total Roles', value: stats.roles.all.toString(), inline: true },
{ name: 'Admin Roles', value: adminRoles.toString(), inline: true },
{ name: 'Bot Roles', value: managedRoles.toString(), inline: true },
{ name: 'Highest Role', value: stats.roles.highest.name, inline: true }
],
color: adminRoles > 5 ? 0xff0000 : 0x00ff00
}]
});
});

😀 Emoji Statistics

Track emoji usage and available slots.

// Total emojis
stats.emojis.all
// Static emojis
stats.emojis.static
// Animated emojis
stats.emojis.animated
// Managed emojis (from integrations)
stats.emojis.managed
// Available emojis
stats.emojis.available
// Max emoji slots (based on boost level)
stats.emojis.maxSlots
// Remaining emoji slots
stats.emojis.remaining
// Example: Emoji capacity command
bot.command.new('emojislots', 'Check emoji capacity', async function() {
const used = stats.emojis.all;
const max = stats.emojis.maxSlots;
const remaining = stats.emojis.remaining;
const percent = Math.round((used / max) * 100);
await this.reply({
embeds: [{
title: '😀 Emoji Capacity',
description: `Using ${used}/${max} slots (${percent}%)`,
fields: [
{ name: 'Static', value: stats.emojis.static.toString(), inline: true },
{ name: 'Animated', value: stats.emojis.animated.toString(), inline: true },
{ name: 'Remaining', value: remaining.toString(), inline: true }
],
color: percent > 90 ? 0xff0000 : 0x00ff00
}]
});
});

🔊 Voice Statistics

Monitor voice channel activity and streaming.

// Members currently in voice
stats.voice.active
// Muted members (server mute or self mute)
stats.voice.muted
// Deafened members
stats.voice.deafened
// Streaming members
stats.voice.streaming
// Members with video enabled
stats.voice.video
// Example: Voice activity command
bot.command.new('voiceactivity', 'Show voice channel activity', async function() {
const active = stats.voice.active;
if (active === 0) {
return await this.reply('🔇 No one is in voice channels right now.');
}
await this.reply({
embeds: [{
title: '🔊 Voice Activity',
fields: [
{ name: 'Total in Voice', value: active.toString(), inline: true },
{ name: 'Streaming', value: stats.voice.streaming.toString(), inline: true },
{ name: 'Video', value: stats.voice.video.toString(), inline: true },
{ name: 'Muted', value: stats.voice.muted.toString(), inline: true },
{ name: 'Deafened', value: stats.voice.deafened.toString(), inline: true }
],
color: 0x5865F2
}]
});
});

💎 Boost Statistics

Track server boost status and progress.

// Current boost level (0-3)
stats.boost.level
// Total boost count
stats.boost.count
// Number of boosters
stats.boost.boosters
// Boosts needed for next level
stats.boost.neededForNext
// Progress to next level (0-100%)
stats.boost.progress
// Example: Boost progress command
bot.command.new('boostprogress', 'Show boost progress', async function() {
const level = stats.boost.level;
const count = stats.boost.count;
const needed = stats.boost.neededForNext;
const progress = Math.round(stats.boost.progress);
const levelNames = ['None', 'Level 1', 'Level 2', 'Level 3'];
const currentLevel = levelNames[level];
let description;
if (level === 3) {
description = '🎉 Max boost level reached!';
} else {
description = `${count} boosts, need ${needed} more for next level`;
}
// Create progress bar
const barLength = 20;
const filled = Math.round((progress / 100) * barLength);
const progressBar = '█'.repeat(filled) + '░'.repeat(barLength - filled);
await this.reply({
embeds: [{
title: '💎 Server Boost Status',
description: description,
fields: [
{ name: 'Current Level', value: currentLevel, inline: true },
{ name: 'Boosters', value: stats.boost.boosters.toString(), inline: true },
{ name: 'Progress', value: `${progressBar} ${progress}%`, inline: false }
],
color: level === 0 ? 0x99aab5 : level === 1 ? 0xf47fff : level === 2 ? 0xf368e0 : 0xff73fa
}]
});
});

🛡️ Moderation Statistics

Track bans and timeouts.

// Ban count (async - requires fetching)
await stats.moderation.bans()
// Members with active timeout
stats.moderation.timedOut
// Example: Moderation overview
bot.command.new('modstats', 'Show moderation stats', async function() {
const bans = await stats.moderation.bans();
const timedOut = stats.moderation.timedOut;
await this.reply({
embeds: [{
title: '🛡️ Moderation Overview',
fields: [
{ name: 'Total Bans', value: bans.toString(), inline: true },
{ name: 'Timed Out', value: timedOut.toString(), inline: true },
{ name: 'Admin Roles', value: stats.roles.admin.toString(), inline: true }
],
color: 0xff0000
}]
});
});

📋 Full Stats Report

Get all statistics in a single object.

// Get complete stats report
const report = await stats.getFullReport();
// Returns an object with all stats:
{
guild: { name, id, description, ownerId, createdAt, age, ... },
members: { all, online, offline, bots, humans, new24h, new7d },
channels: { all, text, voice, categories },
roles: { all, admin, managed },
emojis: { all, static, animated, remaining },
stickers: { all, remaining },
voice: { active, muted, streaming },
boost: { level, count, boosters, neededForNext, progress },
moderation: { bans, timedOut }
}
// Example: Log full report
bot.command.new('fullreport', 'Generate full stats report', async function() {
const report = await stats.getFullReport();
// Send as JSON file
const json = JSON.stringify(report, null, 2);
const buffer = Buffer.from(json, 'utf-8');
await this.reply({
content: '📊 Full server statistics report:',
files: [{
attachment: buffer,
name: `${stats.guild.name}-stats.json`
}]
});
});

📖 Quick API Reference

👥 Members

stats.members.all → Total members
stats.members.online → Online count
stats.members.bots → Bot count
stats.members.new24h → Joined today

🏰 Guild

stats.guild.name → Server name
stats.guild.age → Age in days
stats.guild.verified → Is verified
stats.guild.icon → Icon URL

📢 Channels & Roles

stats.channels.all → Total channels
stats.channels.text → Text channels
stats.roles.all → Total roles
stats.roles.admin → Admin roles

😀 Emojis & Stickers

stats.emojis.all → Total emojis
stats.emojis.maxSlots → Max capacity
stats.emojis.remaining → Free slots
stats.stickers.all → Total stickers

💎 Boosts & Voice

stats.boost.level → Boost level (0-3)
stats.boost.count → Total boosts
stats.boost.progress → Next level %
stats.voice.active → In voice

🛡️ Moderation

await stats.moderation.bans() → Ban count
stats.moderation.timedOut → Timeout count

💡 Tips

  • All stats are real-time - they reflect current server state
  • Stats use getters, so they're always fresh on each access
  • Use getStats(guild) to get stats for a specific guild outside commands
  • Most properties are synchronous except stats.moderation.bans()
  • Emoji/sticker slots automatically adjust based on boost level