5 |
import { random } from "../utils/util"; |
import { random } from "../utils/util"; |
6 |
|
|
7 |
export default class RandomStatus extends Service { |
export default class RandomStatus extends Service { |
8 |
async update(name?: string, type?: ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>, status?: PresenceStatusData) { |
async update(status?: PresenceStatusData) { |
9 |
status ??= random(['dnd', 'idle', 'online'] as PresenceStatusData[]); |
status ??= random(['dnd', 'idle', 'online'] as PresenceStatusData[]); |
10 |
console.log(status); |
console.log(status); |
11 |
|
|
12 |
await this.client.user?.setActivity({ |
await this.client.user?.setActivity({ |
13 |
type: type ?? this.client.config.props.global.status.name ?? 'WATCHING', |
type: this.client.config.props.status?.type ?? 'WATCHING', |
14 |
name: name ?? this.client.config.props.global.status.type ?? 'over the server' |
name: this.client.config.props.status?.name ?? 'over the server' |
15 |
}); |
}); |
16 |
|
|
|
this.client.config.props.global.status = type || name ? {} : null; |
|
|
|
|
|
if (name) { |
|
|
this.client.config.props.global.status.name = name; |
|
|
} |
|
|
|
|
|
if (type) { |
|
|
this.client.config.props.global.status.type = type; |
|
|
} |
|
|
|
|
17 |
await this.client.user?.setStatus(status!); |
await this.client.user?.setStatus(status!); |
18 |
await this.client.config.write(); |
} |
19 |
|
|
20 |
|
async config(name?: string, type?: ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>) { |
21 |
|
this.client.config.props.status ??= {}; |
22 |
|
this.client.config.props.status.type = type ?? 'WATCHING'; |
23 |
|
this.client.config.props.status.name = name ?? 'over the server'; |
24 |
|
this.client.config.write(); |
25 |
} |
} |
26 |
} |
} |