E5BotForSQLite/README.md

95 lines
2.2 KiB
Markdown
Raw Normal View History

# E5SubBot
2020-03-28 22:01:36 +08:00
![](https://img.shields.io/badge/language-go-blue.svg)
![](https://img.shields.io/badge/license-GPL-lightgrey.svg)
2020-03-28 22:01:36 +08:00
A Simple Telebot for E5 Renewal
2020-03-29 13:38:30 +08:00
Golang + MySQL
2020-03-29 13:38:30 +08:00
DEMO: https://t.me/E5Sub_bot
2020-03-29 13:38:30 +08:00
[交流群组telegram](https://t.me/e5subbot)
2020-03-29 13:38:30 +08:00
## 特性
- 自动续订E5订阅(每三小时调用一次)
- 可管理的简易账户系统
- 极为方便的授权方式
## 原理
E5订阅为开发者订阅只要调用相关API就有可能续期
调用 [Outlook ReadMail API](https://docs.microsoft.com/zh-cn/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http) 实现玄学的续订方式,不保证续订效果。
## 使用方法
2020-03-30 22:18:09 +08:00
1. 在机器人对话框输入 **/bind**
2020-03-31 11:00:24 +08:00
2. 注册应用使用E5主账号或同域账号登录跳转页面获得client_secret。**点击回到快速启动**,获得client_id
2020-03-30 22:18:09 +08:00
3. 复制client_secret和client_id`client_id client_secret`格式回复
4. 获得授权链接使用E5主账号或同域账号登录
5. 授权后会跳转至`http://localhost/e5sub……`
6. 复制整个浏览框内容,在机器人对话框回复 `链接+空格+别名(用于管理账户)`
2020-03-29 13:38:30 +08:00
2020-03-30 22:18:09 +08:00
例如:`http://localhost/e5sub/?code=abcd MyE5`,等待机器人绑定后即完成
2020-03-29 13:38:30 +08:00
## 自行部署
2020-03-31 11:00:24 +08:00
需要MySQL>=5.5版本(开发本地环境是5.5,高的低的没测试过,应该也可以)
2020-03-29 13:38:30 +08:00
2020-03-31 11:17:47 +08:00
Bot创建教程:[Google](https://www.google.com/search?q=telegram+Bot%E5%88%9B%E5%BB%BA%E6%95%99%E7%A8%8B)
2020-03-29 13:38:30 +08:00
#### 二进制文件
2020-03-31 09:14:07 +08:00
在[Releases](https://github.com/iyear/E5SubBot/releases)页面下载对应系统的二进制文件,上传至服务器
2020-03-29 13:38:30 +08:00
2020-03-31 10:40:10 +08:00
Windows: 在cmd中启动e5sub.exe
2020-03-29 13:38:30 +08:00
Linux:
```bash
screen -S e5sub
2020-03-29 17:31:35 +08:00
chmod 773 e5sub
2020-03-29 13:38:30 +08:00
./e5sub
(Ctrl A+D)
```
#### 编译
下载源码,安装好环境
```shell
go build main.go
```
2020-03-29 13:38:30 +08:00
## 部署配置
2020-03-31 10:40:10 +08:00
在根目录下创建`config.yml`编码为UTF-8
2020-03-29 13:38:30 +08:00
配置模板
```yaml
2020-03-31 11:17:47 +08:00
#更换为自己的BotToken
2020-03-29 13:38:30 +08:00
bot_token: xxxxx
#不需要socks5代理删去即可
socks5: 127.0.0.1:1080
2020-03-31 08:30:52 +08:00
#公告,/notice触发\n换行,""别删
notice: "第一行\n第二行"
2020-03-29 13:38:30 +08:00
#最大可绑定数
bindmax: 3
2020-03-31 11:17:47 +08:00
#mysql配置请提前创建数据库
2020-03-29 13:38:30 +08:00
mysql:
host: 127.0.0.1
port: 3306
user: e5sub
password: e5sub
database: e5sub
```
## 注意事项
待填写
## License
2020-03-29 13:38:30 +08:00
GPLv3