VPS 一键脚本

用 Telegram 接收 xyz.sh 测试通知

本教程说明如何用自己的 Telegram bot 接收 xyz.sh 的测试通知。站点不会为你托管 bot,token 始终由你提供。

命令
$ curl -fsSL xyz.sh/tg | bash

说明 · xyz.sh/tg · 最后更新:

适用条件

一个 Telegram 账号,以及用 @BotFather 创建的 bot token。

目标对话的 chat id(把消息发给 bot 后可用官方 getUpdates 或其它可靠方式查询)。

本机已安装 curl。

步骤

可选:先阅读源码 curl -fsSL xyz.sh/tg.sh,并核对 xyz.sh/tg.sh.sha256。

先演练:curl -fsSL xyz.sh/tg | bash -s -- --token '<token>' --chat '<chat-id>' --dry-run

再发测试消息:curl -fsSL xyz.sh/tg | bash -s -- --token '<token>' --chat '<chat-id>'

综合测试结束时通知:curl -fsSL xyz.sh/all | bash -s -- -y --share --tg --tg-token '<token>' --tg-chat '<chat-id>'

也可以写成环境变量:XYZ_TG_TOKEN 与 XYZ_TG_CHAT。

如何验证

成功时脚本只打印「已发送」,不会回显 token。Telegram 客户端应出现一条消息。--dry-run 不会发起网络请求。

如何撤销或卸载

本脚本不在服务器上安装任何服务。若不再需要通知,在 Telegram 里停用或删除该 bot 即可,并在命令和环境变量中去掉 token。