UNPKG

n8n-nodes-discord-dnd

Version:
29 lines 984 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initializeDiscordClient = void 0; const discord_js_1 = require("discord.js"); /** * Initializes the Discord client, sets up events, and logs in * @param token Bot token for authentication * @param intents Array of GatewayIntentBits for the client * @throws Error if no token is provided * @returns Discord client instance */ const initializeDiscordClient = async (token, clientOptions) => { if (!token) { throw new Error("No bot token provided in credentials!"); } const client = new discord_js_1.Client(clientOptions); await client.login(token); // Wait for client to be ready if (!client.isReady()) { await new Promise((resolve) => { client.once("ready", () => { resolve(); }); }); } return client; }; exports.initializeDiscordClient = initializeDiscordClient; //# sourceMappingURL=client.js.map