1 |
rakinar2 |
577 |
import { ExcludeEnum, PresenceStatusData } from "discord.js"; |
2 |
|
|
import { ActivityTypes } from "discord.js/typings/enums"; |
3 |
|
|
import DiscordClient from "../client/Client"; |
4 |
|
|
import Service from "../utils/structures/Service"; |
5 |
|
|
import { random } from "../utils/util"; |
6 |
|
|
|
7 |
|
|
export default class RandomStatus extends Service { |
8 |
|
|
async update(name?: string, type?: ExcludeEnum<typeof ActivityTypes, 'CUSTOM'>, status?: PresenceStatusData) { |
9 |
|
|
status ??= random(['dnd', 'idle', 'online'] as PresenceStatusData[]); |
10 |
|
|
console.log(status); |
11 |
|
|
|
12 |
|
|
await this.client.user?.setActivity({ |
13 |
|
|
type: type ?? 'WATCHING', |
14 |
|
|
name: name ?? 'over the server' |
15 |
|
|
}); |
16 |
|
|
|
17 |
|
|
await this.client.user?.setStatus(status!); |
18 |
|
|
} |
19 |
|
|
} |