Skip to content

Commit

Permalink
fix: escape special characters in telegram content (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepChirp authored Oct 10, 2024
1 parent 8b15a44 commit 56d6739
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ async function noticeTelegram(options: CommonOptions) {
},
['tgToken', 'chatId'],
);
let text = options.content;
let text = options.content.replace(/([*_])/g, '\\$1'); // * 和 _ 似乎需要转义,否则会抛出 400 Bad Request 以及消息显示不正常
if (options.title) {
text = `${options.title}\n\n${text}`;
}
Expand Down

0 comments on commit 56d6739

Please sign in to comment.