diff --git a/src/config/statuses.ts b/src/config/statuses.ts index 713b171..19930eb 100644 --- a/src/config/statuses.ts +++ b/src/config/statuses.ts @@ -1,11 +1,12 @@ +import { ActivityType, Guild } from "discord.js" + const statuses = [ - { name: "over the Illegitimate Server", type: 3 }, - { name: "jon and pit edate", type: 3 }, - { name: "for Martina's return", type: 3 }, - { name: "w vri's feelings", type: 0 }, - { name: "urCryhard steal finals again", type: 3 }, - { name: "with Perlcence the AI", type: 0 }, - { name: "with ur mom in my bed", type: 0 }, - { name: "with Jone the idiot", type: 0 } + { name: (guild: Guild) => { return `over ${guild.memberCount} members` }, type: ActivityType.Watching }, + { name: "over the Illegitimate Server", type: ActivityType.Watching }, + { name: "jon and pit edate", type: ActivityType.Watching }, + { name: "for Martina's return", type: ActivityType.Watching }, + { name: "w vri's feelings", type: ActivityType.Playing }, + { name: "urCryhard steal finals again", type: ActivityType.Watching }, + { name: "with Perlcence the AI", type: ActivityType.Playing }, ] export = statuses diff --git a/src/events/server/ready/status.ts b/src/events/server/ready/status.ts index baa4b65..bfb42f8 100644 --- a/src/events/server/ready/status.ts +++ b/src/events/server/ready/status.ts @@ -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") }