From c678f7e58412b3d51b0ea74db538e68226075e97 Mon Sep 17 00:00:00 2001 From: powermaker450 Date: Sat, 22 Jun 2024 19:41:49 -0400 Subject: [PATCH] Please don't send [object object], that is not desired --- src/bot.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index f2ef197..b7fdb9e 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -136,9 +136,8 @@ client.connect().then(async () => { await client.sendMessage({ converseId: message.converseId, groupId: message.groupId, - // @ts-ignore // Surround in [md] tags to support markdown formatting. - content: `[md]${response.choices.at(0)}[/md]`, + content: `[md]${response.choices.at(0)?.message.content}[/md]`, }); fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8"); @@ -170,9 +169,8 @@ client.connect().then(async () => { await client.sendMessage({ converseId: message.converseId, groupId: message.groupId, - // @ts-ignore // Same as above. Surround with [md] tags to support markdown formatting. - content: `[md]${response.choices.at(0)}[/md]`, + content: `[md]${response.choices.at(0)?.message.content}[/md]`, }); fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8"); @@ -213,8 +211,7 @@ client.connect().then(async () => { await client.sendMessage({ converseId: message.converseId, - // @ts-ignore - content: `[md]${response.choices.at(0)}[/md]`, + content: `[md]${response.choices.at(0)?.message.content}[/md]`, }); fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8");