-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mention community project: Plain Nezha Bot (#125)
* Mention community project: Plain Nezha Bot * update project url
- Loading branch information
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` 手动刷新。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |