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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 344 - (hide annotations)
Mon Jul 29 17:29:40 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1012 byte(s)
chore: eslint autofix
1 rakin 71 import { ExcludeEnum, PresenceStatusData } from "discord.js";
2     import { ActivityTypes } from "discord.js/typings/enums";
3 rakin 226 import Service from "../utils/structures/Service";
4 rakin 71 import { random } from "../utils/util";
5    
6 rakin 226 export default class RandomStatus extends Service {
7 rakin 301 async update(status?: PresenceStatusData) {
8 rakin 71 status ??= random(['dnd', 'idle', 'online'] as PresenceStatusData[]);
9     console.log(status);
10    
11     await this.client.user?.setActivity({
12 rakin 301 type: this.client.config.props.status?.type ?? 'WATCHING',
13     name: this.client.config.props.status?.name ?? 'over the server'
14 rakin 71 });
15    
16     await this.client.user?.setStatus(status!);
17     }
18 rakin 301
19     async config(name?: string, type?: ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>) {
20     this.client.config.props.status ??= {};
21     this.client.config.props.status.type = type ?? 'WATCHING';
22     this.client.config.props.status.name = name ?? 'over the server';
23     this.client.config.write();
24 rakin 303 }
25 rakin 71 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26