Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/client/doAutoChangePresence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (C) 2021-2022 PythonCoderAS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { sample } from "lodash";

import { AutoUser } from "../orm/autoUser";
import HealthScreeningBotClient from "./extraClient";

export default async function doAutoChangePresence(
client: HealthScreeningBotClient
): Promise<void> {
const guildSize = client.guilds.cache.size;
const registeredPeople = await AutoUser.count();

const presences: string[] = [
"Generating Health Screenings",
`In ${guildSize} servers`,
`Generating for ${registeredPeople} people!`,
"/generate name:walkthrough for walkthrough of commands!",
"Report a bug with /report_bug!",
"Use /set to set optional configuration info!",
"can i put ma balls on ya jaws",
"Run /stats for cool stats about the bot!",
"Check out your profile with /profile!",
"Have an idea? Suggest it with /suggest!",
];

// We only need to set the name.
await client.user!.setPresence({ activities: [{ name: sample(presences) }] });

setTimeout(() => doAutoChangePresence(client), 300000);
}
Comment thread
PythonCoderAS marked this conversation as resolved.
5 changes: 5 additions & 0 deletions src/client/extraClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import runFunctionAndLogError from "../utils/logError/runAndLog";
import { ItemType } from "../utils/multiMessage";
import postToGithub from "../utils/postToGithub";
import { Command } from "./command";
import doAutoChangePresence from "./doAutoChangePresence";
import doAutoLoop from "./doAutoLoop";
import commandInteraction from "./interactions/commandInteraction";
import commandInteractionAutocomplete from "./interactions/commandInteractionAutocomplete";
Expand Down Expand Up @@ -203,6 +204,10 @@ export default class HealthScreeningBotClient extends Client {
() => doAutoLoop(this, logChannel),
"onReady::doAutoLoop"
),
runFunctionAndLogError(
() => doAutoChangePresence(this),
Comment thread
PythonCoderAS marked this conversation as resolved.
"onReady::doAutoChangePresence"
),
]);
}
}