Skip to content

Commit 214032e

Browse files
author
Muhammad Ali
committed
Fix handler
1 parent 8dd00d0 commit 214032e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

examples/discord-bot/src/handlers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ export function registerHandlers(
2424
typeof raw?.channel_id === "string"
2525
? raw.channel_id
2626
: (event.channel?.id ?? "unknown");
27+
const state = (await event.channel.state) as ThreadState | null;
28+
const currentMode: Mode = state?.mode ?? DEFAULT_MODE;
29+
2730
const stub = await getAgentStub(env, channelId);
2831
const responseText = await stub.ask(
2932
event.text,
3033
channelId,
3134
event.user.userId,
3235
event.user.fullName,
33-
DEFAULT_MODE
36+
currentMode
3437
);
3538

3639
await event.channel.post(

0 commit comments

Comments
 (0)