Add the media MCP tools and live-verified slopbot path

This commit is contained in:
Fisto
2026-09-16 09:54:22 +02:00
parent c81ae0d0fe
commit d483a2fa47
9 changed files with 179 additions and 17 deletions
+10 -1
View File
@@ -3,7 +3,7 @@
* Setup and security: docs/slopbot.md.
*/
import { Client, GatewayIntentBits } from "discord.js";
import { Client, Events, GatewayIntentBits } from "discord.js";
import type { SlopbotConfig } from "./config.js";
import type { SlopbotFetcher } from "./backend.js";
@@ -23,7 +23,16 @@ export async function startSlopbot(config: SlopbotConfig): Promise<Client> {
}
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
// login() resolves before the READY dispatch, so wait for it: the guild cache
// and client.user are only populated then.
const ready = new Promise<void>((resolve, reject) => {
client.once(Events.ClientReady, () => resolve());
client.once(Events.Error, reject);
});
await client.login(config.token);
await ready;
return client;
}