From a16869911a66d5610834333176a17b95cb29c4ca Mon Sep 17 00:00:00 2001 From: Musiker15 Date: Sun, 21 Jun 2026 21:08:42 +0200 Subject: [PATCH] feat(bot): set a custom-status activity (member-list subtitle) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSK Forms showed no subtitle under its name in the member list (unlike the other bots). Set a custom status on ready — global to the bot, configurable via the BOT_ACTIVITY env var (default "📋 forms.msk-scripts.de"; empty disables it). --- apps/bot/src/config.ts | 3 +++ apps/bot/src/index.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/bot/src/config.ts b/apps/bot/src/config.ts index 25d1629..a7df7e7 100644 --- a/apps/bot/src/config.ts +++ b/apps/bot/src/config.ts @@ -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", }; /** diff --git a/apps/bot/src/index.ts b/apps/bot/src/index.ts index 8705478..a0eeda8 100644 --- a/apps/bot/src/index.ts +++ b/apps/bot/src/index.ts @@ -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"; @@ -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);