Skip to content

Commit

Permalink
Mention community project: Plain Nezha Bot (#125)
Browse files Browse the repository at this point in the history
* Mention community project: Plain Nezha Bot

* update project url
  • Loading branch information
uubulb authored Dec 12, 2024
1 parent f6c1bd8 commit 1a987e1
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
]
}
]
Expand Down Expand Up @@ -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' }
]
}
]
Expand Down
40 changes: 40 additions & 0 deletions docs/case/case8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Serverless 哪吒 Telegram 机器人

贡献者:
+ [uubulb](https://codeberg.org/uubulb)

项目地址:<https://github.com/swkisdust/plain-nezha-bot>

单用户单面板多语言私聊哪吒 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` 手动刷新。
40 changes: 40 additions & 0 deletions docs/en_US/case/case8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Serverless Telegram Bot for Nezha

Contributor:
+ [uubulb](https://codeberg.org/uubulb)

Project URL: <https://github.com/swkisdust/plain-nezha-bot>

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.

0 comments on commit 1a987e1

Please sign in to comment.