Update bot configuration and activity type in schema

- Modified package.json to add a new script for setting the bot banner.
- Changed the default activity type in schema.prisma from 'Playing' to 'Watching' for improved bot presence management.
This commit is contained in:
TheOnlyMace
2026-07-22 20:04:11 +02:00
parent bb57b842b9
commit dd93b78c94
5 changed files with 120 additions and 2 deletions

View File

@@ -10,7 +10,7 @@
"test": "vitest run",
"typecheck": "tsc --noEmit -p tsconfig.json",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate deploy"
"profile:banner": "tsx scripts/set-bot-banner.ts"
},
"dependencies": {
"@nexumi/shared": "workspace:*",

View File

@@ -854,7 +854,7 @@ model FeatureFlag {
model BotPresenceConfig {
id String @id @default("singleton")
status String @default("online")
activityType String @default("Playing")
activityType String @default("Watching")
activityText String @default("nexumi.de")
rotatingMessages Json?
maintenanceMode Boolean @default(false)

View File

@@ -0,0 +1,60 @@
/**
* Uploads docs/logo/nexumi-banner.png as the bot user banner (and optional bio)
* via Discord API.
*
* Usage (from repo root):
* pnpm --filter @nexumi/bot profile:banner
*
* Requires BOT_TOKEN in the environment (or root/.env / apps/bot/.env).
*/
import { readFileSync, existsSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { config as loadEnv } from 'dotenv';
const here = dirname(fileURLToPath(import.meta.url));
const repoRoot = resolve(here, '../../..');
for (const candidate of [resolve(repoRoot, '.env'), resolve(here, '../.env')]) {
if (existsSync(candidate)) {
loadEnv({ path: candidate });
}
}
const token = process.env.BOT_TOKEN;
if (!token) {
console.error('BOT_TOKEN is missing.');
process.exit(1);
}
const bannerPath = resolve(repoRoot, 'docs/logo/nexumi-banner.png');
if (!existsSync(bannerPath)) {
console.error(`Banner not found: ${bannerPath}`);
process.exit(1);
}
const png = readFileSync(bannerPath);
const bannerDataUri = `data:image/png;base64,${png.toString('base64')}`;
const bio =
'Moderation, Community & Integrationen — in einem Bot.\n' +
'Dashboard: https://dashboard.nexumi.de\n' +
'nexumi.de';
const response = await fetch('https://discord.com/api/v10/users/@me', {
method: 'PATCH',
headers: {
Authorization: `Bot ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ banner: bannerDataUri, bio })
});
const body = await response.text();
if (!response.ok) {
console.error(`Failed (${response.status}): ${body}`);
process.exit(1);
}
console.log('Bot profile updated successfully.');
console.log(body);