Add the media MCP tools and live-verified slopbot path
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user