add more listeners

add activity service
add log channel service
This commit is contained in:
2026-02-17 23:07:17 +01:00
parent 071fe2f891
commit aa88d30244
14 changed files with 159 additions and 37 deletions

View File

@@ -0,0 +1,27 @@
import client from "lib/client";
import type z from "zod";
import { type Activities, ActivityLocales } from "./activity.schema";
/**
* Set the activity of the bot. This can be used to show that the bot is playing a game, listening to music, etc.
*/
export class ActivityService {
async set(activity: z.output<typeof Activities>) {
if (activity === "invisible") {
client.user?.setPresence({
status: "invisible",
});
client.user?.setActivity(" ", { type: 0 });
return;
}
client.user?.setActivity(ActivityLocales[activity], {
type: 0,
});
client.user?.setPresence({
status: "online",
});
}
}
export const activityService = new ActivityService();