Skip to content

Commit

Permalink
remove json parse
Browse files Browse the repository at this point in the history
  • Loading branch information
siriustaikun committed Aug 31, 2024
1 parent baa2af5 commit 579d555
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion functions/bot/components/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export const translate = async function handler(
let content = res.content[0]! as TextBlock;
let txt = content.text;
// certain markdown characters break telegram https://stackoverflow.com/a/71313944
return JSON.parse(txt.replace("\n\n", ""))
return txt
.replace("\n\n", "")
.replace(/\_/g, "\\_")
.replace(/\*/g, "\\*")
.replace(/\[/g, "\\[")
Expand Down

0 comments on commit 579d555

Please sign in to comment.