From baba05c01da7cc3155e8f0c09c553fb547075f63 Mon Sep 17 00:00:00 2001 From: BarryY Date: Fri, 16 May 2025 16:26:39 +0800 Subject: [PATCH] fix: Fix client state not updated after login --- src/tools/login.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/login.ts b/src/tools/login.ts index 3a225c0..6b7d348 100644 --- a/src/tools/login.ts +++ b/src/tools/login.ts @@ -75,8 +75,10 @@ export const loginHandler: ToolHandler = async (args, context) => { context.client.token = args.token; } - // Attempt to log in with the token - await context.client.login(token); + // Attempt to log in with the token and get the ready client + const readyClient = await waitForReady(context.client, token); + // Update the context client with the ready client + context.client = readyClient; return { content: [{ type: "text", text: `Successfully logged in to Discord: ${context.client.user?.tag}` }] };