diff --git a/apps/bot/package.json b/apps/bot/package.json index 94f9719..d4d9004 100644 --- a/apps/bot/package.json +++ b/apps/bot/package.json @@ -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:*", diff --git a/apps/bot/prisma/schema.prisma b/apps/bot/prisma/schema.prisma index f46f7b6..e570a01 100644 --- a/apps/bot/prisma/schema.prisma +++ b/apps/bot/prisma/schema.prisma @@ -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) diff --git a/apps/bot/scripts/set-bot-banner.ts b/apps/bot/scripts/set-bot-banner.ts new file mode 100644 index 0000000..43a7c2d --- /dev/null +++ b/apps/bot/scripts/set-bot-banner.ts @@ -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); diff --git a/docs/logo/nexumi-banner.png b/docs/logo/nexumi-banner.png new file mode 100644 index 0000000..45d4258 Binary files /dev/null and b/docs/logo/nexumi-banner.png differ diff --git a/docs/logo/nexumi-banner.svg b/docs/logo/nexumi-banner.svg new file mode 100644 index 0000000..6674e84 --- /dev/null +++ b/docs/logo/nexumi-banner.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Nexumi + nexumi.de +