/[sudobot]/trunk/src/services/RandomStatus.ts
ViewVC logotype

Contents of /trunk/src/services/RandomStatus.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (show annotations)
Mon Jul 29 17:28:28 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 741 byte(s)
Release version 2.0.0-beta2
1 import { ExcludeEnum, PresenceStatusData } from "discord.js";
2 import { ActivityTypes } from "discord.js/typings/enums";
3 import DiscordClient from "../client/Client";
4 import { random } from "../utils/util";
5
6 export default class RandomStatus {
7 constructor(protected client: DiscordClient) {
8
9 }
10
11 async update(name?: string, type?: ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>, status?: PresenceStatusData) {
12 status ??= random(['dnd', 'idle', 'online'] as PresenceStatusData[]);
13 console.log(status);
14
15 await this.client.user?.setActivity({
16 type: type ?? 'WATCHING',
17 name: name ?? 'over the server'
18 });
19
20 await this.client.user?.setStatus(status!);
21 }
22 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26