From 1a987e10cdde1c387533a66b1b5d8320681b4174 Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:21:34 +0800 Subject: [PATCH] Mention community project: Plain Nezha Bot (#125) * Mention community project: Plain Nezha Bot * update project url --- docs/.vitepress/config.mts | 6 ++++-- docs/case/case8.md | 40 ++++++++++++++++++++++++++++++++++++++ docs/en_US/case/case8.md | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 docs/case/case8.md create mode 100644 docs/en_US/case/case8.md diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 548b96c51..479751325 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -214,7 +214,8 @@ function getCaseSidebarZhCN() { { text: '4. Fake-agent,监控数据作弊器', link: '/case/case4.html' }, { text: '5. 使用 Argo 隧道的哪吒服务端', link: '/case/case5.html' }, { text: '6. Nezha Mobile - Nezha Dashboard 的 iOS 客户端', link: '/case/case6.html' }, - { text: '7. Broker for Nezha', link: '/case/case7.html' } + { text: '7. Broker for Nezha', link: '/case/case7.html' }, + { text: '8. Serverless 哪吒 Telegram 机器人', link: '/case/case8.html' } ] } ] @@ -288,7 +289,8 @@ function getCaseSidebarEnUS() { { text: '4. Fake-agent, monitoring data cheater', link: '/en_US/case/case4.html' }, { text: '5. Nezha server over Argo tunnel', link: '/en_US/case/case5.html' }, { text: '6. Nezha Mobile - An iOS Client For Nezha Dashboard', link: '/en_US/case/case6.html' }, - { text: '7. Broker for Nezha', link: '/en_US/case/case7.html' } + { text: '7. Broker for Nezha', link: '/en_US/case/case7.html' }, + { text: '8. Serverless Telegram Bot for Nezha', link: '/en_US/case/case8.html' } ] } ] diff --git a/docs/case/case8.md b/docs/case/case8.md new file mode 100644 index 000000000..f4ed91e35 --- /dev/null +++ b/docs/case/case8.md @@ -0,0 +1,40 @@ +# Serverless 哪吒 Telegram 机器人 + +贡献者: ++ [uubulb](https://codeberg.org/uubulb) + +项目地址: + +单用户单面板多语言私聊哪吒 Telegram 机器人,可以在 Cloudflare Workers 上部署。 + +Inspired by https://github.com/nezhahq/Nezha-Telegram-Bot-V1 + +## 部署 + +1. Clone 本项目,运行 `npm install` 安装依赖。 +2. 用你喜欢的方式创建一个 Workers KV 命名空间,保存下 ID。 +3. 修改 `wrangler.toml`,将 `kv_namespaces` 字段改为你创建的 KV 信息。 +4. 修改 `wrangler.toml` 中的 `vars`: + + - `NZ_BASEURL`:面板地址,例如 `https://ops.naibahq.com`。 + - `LANG`:语言,可选 `en` `zh-CN`,默认为 `en`。 + - `ENDPOINT_PATH`:接收 Telegram Webhook 的路由路径,例如 `/endpoint`。 + +5. 创建以下 Secrets: + + - `TELEGRAM_BOT_TOKEN`:从 BotFather 那里获取的机器人 Token。 + - `TELEGRAM_SECRET`:Webhook 认证密钥。 + - `TELEGRAM_UID`:用户 UID,机器人将不会与除此 UID 外的任何人互动。 + - `PASSWORD`:基本认证密码,用于进行 注册 / 取消注册 / 刷新 Token 操作。 + - `NZ_USERNAME`:面板用户名,用于初次认证及后续刷新。 + - `NZ_PASSWORD`:面板密码,用于初次认证及后续刷新。 + +6. 输入 `npx wrangler deploy` 部署项目。 + +## 使用 + +访问 `/register` 路由注册 Webhook 即可开始使用。 + +如暂时不需使用,可以访问 `/unregister` 删除 Webhook。 + +默认每 30 分钟触发一次 Token 刷新操作,可以在 `wrangler.toml` 中手动修改,或是访问 `/refresh` 手动刷新。 diff --git a/docs/en_US/case/case8.md b/docs/en_US/case/case8.md new file mode 100644 index 000000000..aa95b77b1 --- /dev/null +++ b/docs/en_US/case/case8.md @@ -0,0 +1,40 @@ +# Serverless Telegram Bot for Nezha + +Contributor: ++ [uubulb](https://codeberg.org/uubulb) + +Project URL: + +A single-user, single-instance, multi-language private chat Nezha Telegram bot that can be deployed on Cloudflare Workers. + +Inspired by https://github.com/nezhahq/Nezha-Telegram-Bot-V1 + +## Deployment + +1. Clone this project and run `npm install` to install dependencies. +2. Create a Workers KV namespace using your preferred method and save its ID. +3. Modify `wrangler.toml` and update the `kv_namespaces` field with your KV information. +4. Modify `wrangler.toml` under `vars`: + + - `NZ_BASEURL`: Panel address, e.g., `https://ops.naibahq.com`. + - `LANG`: Language, options are `en` and `zh-CN`, default is `en`. + - `ENDPOINT_PATH`: Route path for receiving Telegram Webhook, e.g., `/endpoint`. + +5. Create the following Secrets: + + - `TELEGRAM_BOT_TOKEN`: Bot token obtained from BotFather. + - `TELEGRAM_SECRET`: Webhook authentication key. + - `TELEGRAM_UID`: User UID, the bot will not interact with anyone other than this UID. + - `PASSWORD`: Basic authentication password for register/unregister/refresh token operations. + - `NZ_USERNAME`: Panel username for initial authentication and subsequent refreshes. + - `NZ_PASSWORD`: Panel password for initial authentication and subsequent refreshes. + +6. Run `npx wrangler deploy` to deploy the project. + +## Usage + +Access the `/register` route to register the Webhook and start using the bot. + +If you do not need the bot temporarily, you can access `/unregister` to remove the Webhook. + +By default, the token refresh operation is triggered every 30 minutes. You can modify this manually in `wrangler.toml` or access `/refresh` to refresh manually.