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");