Skip to content

Commit

Permalink
⚡️ Update onReady function to display server count in activity
Browse files Browse the repository at this point in the history
  • Loading branch information
MotiCAT committed Jan 15, 2024
1 parent 47aa578 commit ae4b6e1
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/Events/onReady.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Client, version } from 'discord.js';

export function onReady(client: Client) {
console.log(`Logged in as ${client.user?.tag}`);
client.user?.setActivity('mc!help | Created By CH Products');
setInterval(() => {
client.user?.setActivity(`mc!help | Created By CH Products | ${client.guilds.cache.size} Servers`);
}, 10000);
console.table({
'Bot User': client.user?.tag,
'Guild(s)': client.guilds.cache.size + ' Servers',
Expand All @@ -17,17 +19,4 @@ export function onReady(client: Client) {
'MB'
// Quote from: https://github.com/Nich87/Faith
});

const activities = ['mc!help Created By CH Products', `${client.guilds.cache.size} Servers | ${client.guilds.cache.reduce((a, b) => a + b.memberCount, 0)} Users`,];

let currentActivityIndex = 0;

setInterval(() => {
const nextActivityIndex = (currentActivityIndex + 1) % activities.length;
const nextActivity = activities[nextActivityIndex];

client.user?.setActivity(nextActivity);

currentActivityIndex = nextActivityIndex;
}, 10000);
}

0 comments on commit ae4b6e1

Please sign in to comment.