add more listeners
add activity service add log channel service
This commit is contained in:
27
adapters/discord/src/features/activity/activity.service.ts
Normal file
27
adapters/discord/src/features/activity/activity.service.ts
Normal 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();
|
||||
Reference in New Issue
Block a user