Updated statuses

This commit is contained in:
2024-02-16 17:29:03 +01:00
parent 0ec9b1b528
commit b6e27b3741
2 changed files with 25 additions and 20 deletions

View File

@@ -1,4 +1,6 @@
import { guildid } from "config/options"
import statuses from "config/statuses"
import { Guild } from "discord.js"
import { IEvent } from "interfaces"
import { ExtendedClient as Client } from "utils/Client"
@@ -8,22 +10,24 @@ export = {
event: "ready",
execute(client: Client) {
// Playing 0
// Streaming 1
// Listening 2
// Watching 3
// Custom 4
// Competing 5
const user = client.user!
const guild = client.guilds.cache.get(guildid) as Guild
user.setActivity({ name: statuses[0].name, type: statuses[0].type })
function getActivity(status: ((guild: Guild) => string) | string): string {
if (typeof status === "function") {
return status(guild)
} else {
return status
}
}
user.setActivity({ name: getActivity(statuses[0].name), type: statuses[0].type })
let i = 1
setInterval(
() => user.setActivity(statuses[i++ % statuses.length]),
1000 * 60 * 10
)
setInterval(() => {
const status = i++ % statuses.length
user.setActivity({ name: getActivity(statuses[status].name), type: statuses[status].type })
}, 1000 * 60 * 10)
user.setStatus("dnd")
}