Skip to content

Commit 0fa1ba6

Browse files
committed
Finished Handler and addes actvity job
1 parent 2d9dca5 commit 0fa1ba6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/cron/activity.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export default {
2+
cron: '*/15 * * * * *',
3+
async execute(client) {
4+
let activityList = [
5+
`with ${client.guilds.cache.size} servers`,
6+
`with ${client.users.cache.size} users`,
7+
`with ${client.channels.cache.size} channels`,
8+
`with ${client.emojis.cache.size} emojis`,
9+
];
10+
11+
let activity = activityList[Math.floor(Math.random() * activityList.length)];
12+
client.user.setActivity(activity, {
13+
name: activity,
14+
type: 1
15+
});
16+
}
17+
};

src/handlers/cronjobs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'fs';
22
import cron from 'node-cron';
3+
import chalk from 'chalk';
34

45
export async function loadCronJobs(folderPath, client) {
56
let files = fs.readdirSync(folderPath);
@@ -8,5 +9,6 @@ export async function loadCronJobs(folderPath, client) {
89
folderPath = folderPath.replace('src/', '');
910
let cronjob = await import (`../${folderPath}/${files[i]}`);
1011
cron.schedule(cronjob.default.cron, () => cronjob.default.execute(client));
12+
console.log(chalk.greenBright(`[CRONJOB] Loaded ${(chalk.yellow(files[i]))}`));
1113
}
1214
}

0 commit comments

Comments
 (0)