From 83213aa9e5c0fd20d79b742ddc97b8fc258756f3 Mon Sep 17 00:00:00 2001
From: iyear <61452000+iyear@users.noreply.github.com>
Date: Wed, 17 Jun 2020 17:39:01 +0800
Subject: [PATCH] README in English
---
README.md | 189 ++++++++++++++++++++++++------------------------------
1 file changed, 84 insertions(+), 105 deletions(-)
diff --git a/README.md b/README.md
index a1b49e5..ac5b6b0 100644
--- a/README.md
+++ b/README.md
@@ -1,65 +1,68 @@
# E5SubBot
-
-
-
+
+
+
+
+English | [简体中文](https://github.com/iyear/E5SubBot/README_zhCN.md)
A Simple Telebot for E5 Renewal
-Golang + MySQL
+`Golang` + `MySQL`
-DEMO: https://t.me/E5Sub_bot (长期运行,所有新功能会在DEMO测试)
+DEMO: https://t.me/E5Sub_bot (all new functions will be tested in DEMO)
-[交流群组telegram](https://t.me/e5subbot)
+Communication: [Telegram Group](https://t.me/e5subbot)
-## 预览
-- [绑定过程](https://raw.githubusercontent.com/iyear/E5SubBot/master/pics/bind.JPG)
-- [查看"我的"](https://raw.githubusercontent.com/iyear/E5SubBot/master/pics/my.JPG)
-- [任务反馈](https://raw.githubusercontent.com/iyear/E5SubBot/master/pics/task.JPG)
+## Preview
+
+ 

+
-## 特性
+## Feature
-- 自动续订E5订阅(可自定义的调用频率)
-- 可管理的简易账户系统
-- 完善的任务执行反馈
-- 极为方便的授权方式
+- Automatically Renew E5 Subscription(Customizable Frequency)
+- Manageable Simple Account System
+- Available Task Execution Feedback
+- Convenient Authorization
-## 原理
+## Principle
-E5订阅为开发者订阅,只要调用相关API就有可能续期
+E5 subscription is a subscription for developers, as long as the related API is called, it may be renewed
-调用 [Outlook ReadMail API](https://docs.microsoft.com/zh-cn/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http) 实现玄学的续订方式,不保证续订效果。
+Calling [Outlook ReadMail API](https://docs.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http) to renew, does not guarantee the renewal effect.
-## 使用方法
+## Usage
-1. 在机器人对话框输入 **/bind**
-2. 注册应用,使用E5主账号或同域账号登录,跳转页面获得client_secret。**点击回到快速启动**,获得client_id
-3. 复制client_secret和client_id,以 `client_id client_secret`格式回复
-4. 获得授权链接,使用E5主账号或同域账号登录
-5. 授权后会跳转至`http://localhost/e5sub……`
-6. 复制整个浏览框内容,在机器人对话框回复 `链接+空格+别名(用于管理账户)`
-例如:`http://localhost/e5sub/?code=abcd MyE5`,等待机器人绑定后即完成
+1. Type `/bind` in the robot dialog
+2. Click the link sent by the robot and register the Microsoft application, log in with the E5 master account or the same domain account, and obtain `client_secret`. **Click to go back to Quick Start**, get `client_id`
+3. Copy `client_secret` and `client_id` and reply to bot in the format of `client_id(space)client_secret`
+(Pay attention to spaces)
+4. Click on the authorization link sent by the robot and log in with the `E5` master account or the same domain account
+5. After authorization, it will jump to `http://localhost/e5sub……` (will prompt webpage error, just copy the link)
+6. Copy the link, and reply `link(space)alias (used to manage accounts)` in the robot dialog
+For example: `http://localhost/e5sub/?code=abcd MyE5`, wait for the robot to bind and then complete
-## 自行部署
-需要MySQL>=5.5版本(开发本地环境是5.5,高的低的没测试过,应该也可以)
-Bot创建教程:[Google](https://www.google.com/search?q=telegram+Bot%E5%88%9B%E5%BB%BA%E6%95%99%E7%A8%8B)
+## Deploy Your Own Bot
-### Docker部署
-感谢 [@kzw200015](https://github.com/kzw200015) 提供`Dockerfile`以及`Docker`方面的帮助
+Bot creation tutorial : [Microsoft](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-telegram?view=azure-bot-service-4.0)
-第一次启动不行,使用 `docker-compose restart`重启一次
+### Docker Deployment
+Thanks to [@kzw200015](https://github.com/kzw200015) for providing help in `Dockerfile` and `Docker`
+
+If it fails to start for the first time, use `docker-compose restart` to restart
```bash
mkdir ./e5bot && wget --no-check-certificate -O ./e5bot/config.yml https://raw.githubusercontent.com/iyear/E5SubBot/master/config.yml.example
vi ./e5bot/config.yml
wget --no-check-certificate https://raw.githubusercontent.com/iyear/E5SubBot/master/docker-compose.yml
docker-compose up -d
```
-### 二进制文件
+### Binary Deployment
-在[Releases](https://github.com/iyear/E5SubBot/releases)页面下载对应系统的二进制文件,上传至服务器
+Download the binary files of the corresponding system on the [Releases](https://github.com/iyear/E5SubBot/releases) page and upload it to the server
-Windows: 在cmd中启动 `E5SubBot.exe`
+Windows: Start `E5SubBot.exe` in `cmd`
Linux:
@@ -69,40 +72,28 @@ chmod 773 E5SubBot
./E5SubBot
(Ctrl A+D)
```
-### 编译
+### Compile
-下载源码,安装好环境
+Download the source code and install the GO environment
```shell
go build
```
-## 部署配置
+## Configuration
-在根目录下创建`config.yml`,编码为UTF-8
+Create `config.yml` in the same directory, encoded as `UTF-8`
-配置模板
+Configuration Template:
```yaml
-#bindmax,notice,admin,errlimit可热更新,直接更新config.yml保存即可
-#更换为自己的BotToken
-bot_token: xxxxx
-#不需要socks5代理删去即可
+bot_token: YOUR_BOT_TOKEN
socks5: 127.0.0.1:1080
-#公告,合并至/help
-notice: "第一行\n第二行"
-#管理员tgid,前往https://t.me/userinfobot获取,用,隔开
-#管理员权限: 手动调用任务,获得任务总反馈
+notice: "first line \n second line"
admin: 66666,77777,88888
-#任务最大出错次数,满后自动解绑账户并发送通知,无限次数将值改为负数(-1)即可
-#以ms账户为单位,不会解绑所有账户(只解绑错误账户)
-#主要为了减少资源浪费.bot重启后会清零所有错误次数
errlimit: 5
-#API调用频率,使用cron表达式
cron: "1 */3 * * *"
-#最大可绑定数
bindmax: 3
-#mysql配置,请提前创建数据库
mysql:
host: 127.0.0.1
port: 3306
@@ -110,67 +101,55 @@ mysql:
password: e5sub
database: e5sub
```
-### 命令
+
+`bindmax`, `notice`, `admin`, `errlimit` can be hot updated, just update `config.yml` to save.
+| Configuration | Explanation|
+| ---- | ---- |
+| bot_token | Change to your own `BotToken` |
+| socks5 | `Socks5` proxy,if you do not need ,you should delete it. For example: `127.0.0.1:1080` |
+|notice|Announcement. Merged into `/help`|
+|admin|The administrator's `tgid`, go to https://t.me/userinfobot to get it, separated by `,`; Administrator permissions: manually call the task, get the total feedback of the task|
+|errlimit|The maximum number of errors for a single account, automatically unbind the single account and send a notification when it is full, without limiting the number of errors, change the value to a negative number `(-1)`; all errors will be cleared after the bot restarts|
+|cron|API call frequency, using `cron` expression|
+|bindmax|Maximum number of bindable|
+|mysql|Mysql configuration, please create database in advance|
+
+### Command
```
-/my 查看已绑定账户信息
-/bind 绑定新账户
-/unbind 解绑账户
-/export 导出账户信息(JSON格式)
-/help 帮助
-/task 手动执行一次任务(管理员)
-/log 获取最近日志文件(管理员)
+/my View bound account information
+/bind Bind new account
+/unbind Unbind account
+/export Export account information (JSON format)
+/help help
+/task Manually execute a task (Bot Administrator)
+/log Get the most recent log file (Bot Administrator)
```
-## 注意事项
-> 更新时间与北京时间不符
+## Others
+> Feedback time is not as expected
-更改服务器时区为Asia/Shanghai,然后使用/task手动执行一次任务刷新时间
+Change the server time zone, use `/task` to manually perform a task to refresh time.
-> 绑定格式错误
+> ERROR:Can't create more than max_prepared_stmt_count statements (current value: 16382).
-不要带"+"号
+Failure to close `db` leads to triggering `mysql` concurrency limit, please update to `v0.1.9`.
-> 错误:Can't create more than max_prepared_stmt_count statements (current value: 16382)
+> Long running crash
-没有关闭db导致触发mysql并发上限,请更新至v0.1.9
-
-## 小总结
-#### 得到了什么?
-- git的基本操作:add,commit,pull,push.但是对代码合并与冲突解决没有得到足够的实践和深入
-- github版本库方面的使用(issue,pull request...),还有一些没玩过
-- 体验了Docker Hub 的自动构建
-- sql的CRUD,但都只是浮于表面,有时间再去琢磨
-- telegram bot的golang基本框架和一些有意思的玩法
-- 一些著名第三方库(viper,gjson)的基本用法
-- docker以及docker-compose的基本用法
-- 一些工具:gox;goreleaser的基本用法
-- ……
-#### 还缺点什么?
-
-- 对`CGO`知难而退,编译各种出错。下个项目如果用到`sqlite`一定解决`CGO`交叉编译
-- `DockerFile` 还不会写
-- 对项目的概念和意识不太行,目录太乱,随缘写全局变量
-- 看`telebot`的文档还好,看`stackflow` 只能看看代码。搜索还是习惯性带中文导致`stackflow`很难出现,降低了解决问题的效率
-
-#### 最后
-
-从2020.3.28开发至2020.4.12,一共经历14天,利用课余时间最终完成。
-
-就要开学了,因为马上步入高三,学习紧迫,遂不再进行功能开发。
-
-项目差不多就停更了,最多也就是每个星期看看issue、tg群组,修一修bug
-
-**DEMO依旧能保持服务水平,不会因为个人问题在这段时间停止运行**
-
-如果一年后还有人在用,一定会继续
+Suspected memory leak. Not yet resolved, please run the daemon or restart Bot regularly.
## Third-Party
-- [telebot](https://gopkg.in/tucnak/telebot)
-- [mysql_driver](https://github.com/go-sql-driver/mysql)
-- [gjson](https://github.com/tidwall/gjson)
-- [cron](https://github.com/robfig/cron/)
-- [viper](https://github.com/spf13/viper)
-- [goreleaser](https://https://github.com/goreleaser/goreleaser)
+- [Telebot](https://gopkg.in/tucnak/telebot)
+- [Mysql_driver](https://github.com/go-sql-driver/mysql)
+- [Gjson](https://github.com/tidwall/gjson)
+- [Cron](https://github.com/robfig/cron/)
+- [Viper](https://github.com/spf13/viper)
+- [Goreleaser](https://https://github.com/goreleaser/goreleaser)
+## Contributing
+- Provide documentation in other languages
+- Provide help for code operation
+- Suggests user interaction
+- ……
## License
GPLv3