Skip to content
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
3 changes: 3 additions & 0 deletions apps/bot/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export const config = {
clientId: process.env.DISCORD_CLIENT_ID ?? "",
apiBaseUrl: process.env.APP_URL ?? "http://localhost:3000",
webhookSecret: process.env.INTERNAL_WEBHOOK_SECRET ?? "",
// Custom-status text shown under the bot in the member list (global to the
// bot). Override via BOT_ACTIVITY; empty string disables it.
activity: process.env.BOT_ACTIVITY ?? "📋 forms.msk-scripts.de",
};

/**
Expand Down
9 changes: 8 additions & 1 deletion apps/bot/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Events, GatewayIntentBits, MessageFlags } from "discord.js";
import { ActivityType, Client, Events, GatewayIntentBits, MessageFlags } from "discord.js";

import { registerCommands } from "./commands.js";
import { assertConfig, config } from "./config.js";
Expand All @@ -21,6 +21,13 @@ export function createClient(): Client {

client.once(Events.ClientReady, async (c) => {
console.info(`[bot] Logged in as ${c.user.tag} — ${c.guilds.cache.size} guild(s).`);
// Member-list subtitle (custom status). Global to the bot; configurable via BOT_ACTIVITY.
if (config.activity) {
c.user.setPresence({
status: "online",
activities: [{ name: "MSK Forms", type: ActivityType.Custom, state: config.activity }],
});
}
await syncAllGuilds(c);
// Drain the outbox now, then poll on an interval.
void deliverPendingNotifications(c);
Expand Down