Skip to content

Commit f46a45e

Browse files
committed
feat: update sendMessage options
1 parent 4516da4 commit f46a45e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ export default {
88
try {
99
const body = await request.json()
1010

11-
// 构建发送到 Telegram 的消息内容
1211
let message = "Hello world"
1312
if (githubEvent === 'watch') {
1413
message = makeMessage(body)
1514
}
1615

17-
// 发送消息到 Telegram
16+
// send message to Telegram
17+
// api docs - https://core.telegram.org/bots/api#sendmessage
1818
const telegramUrl = `https://api.telegram.org/bot${env.TELEGRAM_TOKEN}/sendMessage`
1919

2020
const telegramPayload = {
2121
chat_id: env.TELEGRAM_CHAT_ID,
2222
text: message,
23-
parse_mode: "Markdown"
23+
parse_mode: "Markdown",
24+
link_preview_options: { is_disabled: true }
2425
}
2526

2627
const telegramResponse = await fetch(telegramUrl, {
@@ -54,7 +55,7 @@ function makeMessage(body) {
5455

5556
return `
5657
New Github star for [${repo}](${repoUrl}) repo!
57-
The ${repo} repo now has ${stargazers_count} starts and ${forks_count} forks!🎉
58+
The *${repo}* repo now has *${stargazers_count}* starts and *${forks_count}* forks!🎉
5859
Your new fan is [${follwer}](${follwerUrl})
5960
`
6061
}

0 commit comments

Comments
 (0)