Skip to content

Commit c4b285b

Browse files
committed
added activity updates
1 parent 48cc1af commit c4b285b

4 files changed

Lines changed: 90 additions & 9 deletions

File tree

src/events/activityUpdate.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { ActivityType, Client, Events } from "discord.js";
2+
3+
function getStatus(guilds: number, users: number) {
4+
const statuses = [
5+
`Managing ${guilds} servers!`,
6+
`Watching over ${users} users 👀`,
7+
`Boost, boost, boost! 🚀`,
8+
`Keeping communities active ✨`,
9+
`Powering Discord servers ⚡`,
10+
`Tracking boosts in real-time 📈`,
11+
`Helping servers grow 🌱`,
12+
`Thanking boosters 24/7 💜`,
13+
`Making server management easier 🛠️`,
14+
`Serving ${guilds} amazing communities 🎉`,
15+
`Keeping the hype alive 🔥`,
16+
`Boostify never sleeps 😴`,
17+
`Running on caffeine and Node.js ☕`,
18+
`Auto-managing booster perks 🎁`,
19+
`Boosters deserve the best 💎`,
20+
`Syncing rewards like magic ✨`,
21+
`Moderating with style 🕶️`,
22+
`Open-source and proud 🌍`,
23+
`Your server’s best assistant 🤖`,
24+
`Made with TypeScript 💙`,
25+
`Keeping roles in sync 🔄`,
26+
`Boosting experiences daily 🚀`,
27+
`Listening to slash commands 🎧`,
28+
`Managing chaos professionally 😎`,
29+
`Protecting the server vibes 🛡️`,
30+
`One boost at a time 💜`,
31+
`Currently in ${guilds} servers 🌐`,
32+
`Making Discord better ✨`,
33+
`discord.js supremacy 👑`,
34+
`Hosting the booster revolution 🚀`,
35+
];
36+
37+
return statuses[Math.floor(Math.random() * statuses.length)];
38+
}
39+
40+
export default {
41+
name: Events.ClientReady,
42+
once: true,
43+
44+
execute(client: Client) {
45+
if (!client.user) return;
46+
47+
const updatePresence = () => {
48+
const guilds = client.guilds.cache.size;
49+
50+
const users = client.guilds.cache.reduce(
51+
(acc, guild) => acc + (guild.memberCount || 0),
52+
0
53+
);
54+
55+
client.user!.setActivity({
56+
type: ActivityType.Custom,
57+
name: getStatus(guilds, users),
58+
});
59+
};
60+
61+
setTimeout(() => {
62+
updatePresence();
63+
setInterval(updatePresence, 1000 * 60 * 60);
64+
}, 3000);
65+
},
66+
};

src/events/clientReady.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
import { Client, Events } from "discord.js";
1+
import { ActivityType, Client, Events } from "discord.js";
22
import { logger } from "../libs/logger.js";
3-
import { processDueCustomRoleDeletions } from "../services/customRoleCleanup.js";
4-
5-
const CUSTOM_ROLE_CLEANUP_MS = 60 * 60 * 1000;
63

74
export default {
85
name: Events.ClientReady,
96
once: true,
107
execute(client: Client) {
118
if (!client.user) return;
129
logger.bot(`Ready! Logged in as ${client.user.tag}`);
13-
14-
void processDueCustomRoleDeletions(client);
15-
setInterval(() => {
16-
void processDueCustomRoleDeletions(client);
17-
}, CUSTOM_ROLE_CLEANUP_MS);
1810
},
1911
};

src/events/roleCleanup.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Client, Events } from "discord.js";
2+
import { logger } from "../libs/logger.js";
3+
import { processDueCustomRoleDeletions } from "../services/customRoleCleanup.js";
4+
5+
const CUSTOM_ROLE_CLEANUP_MS = 60 * 60 * 1000;
6+
7+
export default {
8+
name: Events.ClientReady,
9+
once: true,
10+
execute(client: Client) {
11+
if (!client.user) return;
12+
13+
void processDueCustomRoleDeletions(client);
14+
setInterval(() => {
15+
void processDueCustomRoleDeletions(client);
16+
}, CUSTOM_ROLE_CLEANUP_MS);
17+
},
18+
};

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ process.on("uncaughtException", (error) => {
2323
);
2424
});
2525

26+
if (!fs.existsSync(path.join(__dirname, 'generated'))) {
27+
logger.fatal(`No generated prisma folder could be found at ${__dirname}, to generate run ${chalk.bold("npm run prisma:generate")}.`)
28+
throw new Error(`No prisma folder found`)
29+
}
30+
2631
process.on("unhandledRejection", (reason) => {
2732
const safeStringify = (value: unknown): string => {
2833
try {

0 commit comments

Comments
 (0)