Compare commits

...

13 Commits

Author SHA1 Message Date
luming
ba170eb3d7 fix admin chat error
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is failing
2021-05-19 16:04:28 +08:00
bdfcd71fdb
Update .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is failing
2021-03-24 18:51:30 +08:00
7feaea08da
Update .drone.yml 2021-03-24 18:30:47 +08:00
f068f53112
Update .drone.yml 2021-03-24 18:29:21 +08:00
628373ce58
Create .drone.yml 2021-03-24 17:39:18 +08:00
64bd4d68f7 📝 update document. 2021-01-18 16:50:13 +08:00
5a5c24eeaf Modify configuration file.
Add a language item.
2021-01-18 14:22:58 +08:00
ad4b39d8dd add systemd unit file. 2021-01-17 18:45:28 +08:00
rainerosion
5f98f4de29 🌐 Modify link 2020-12-28 23:27:21 +08:00
rainerosion
6384d46dad 📝 update documents 2020-12-27 00:17:41 +08:00
rainerosion
1084e1814a 📝 update documents 2020-12-17 21:07:09 +08:00
rainerosion
4095894f89 📝 update documents 2020-12-16 19:51:42 +08:00
rainerosion
e62bd1f2f5 📝 add language 2020-12-16 02:27:51 +08:00
7 changed files with 56 additions and 63 deletions

9
.drone.yml Normal file
View File

@ -0,0 +1,9 @@
kind: pipeline
type: docker
name: E5SubBotForSQLite
steps:
- name: gobuild
image: golang:alpine
pull: if-not-exists
commands:
- CGO_ENABLED=1 go build

View File

@ -48,16 +48,19 @@ Bot creation tutorial : [Microsoft](https://docs.microsoft.com/en-us/azure/bot-s
### Docker
```bash
wget --no-check-certificate -O /root/config.yml https://raw.githubusercontent.com/rainerosion/E5SubBot/master/config.yml.example
mkdir /opt/e5sub
# (important)Create database file
touch /opt/e5sub/e5sub.db
wget --no-check-certificate -O /opt/e5sub/config.yml https://raw.githubusercontent.com/rainerosion/E5SubBotForSQLite/master/config.yml.example
# Modify configuration file
vim /root/config.yml
docker run -d -v /root/config.yml:/root/config.yml --restart=always --name e5bot rainerosion/e5subbot-sqlite
vim /opt/e5sub/config.yml
docker run -d -v /opt/e5sub/config.yml:/root/config.yml -v /opt/e5sub/e5sub.db:/root/e5sub.db --restart=always --name e5bot rainerosion/e5subbot-sqlite
```
### Binary Deployment
Download the binary files of the corresponding system on the [Releases](https://github.com/rainerosion/E5SubBot/releases) page and upload it to the server
Download the binary files of the corresponding system on the [Releases](https://github.com/rainerosion/E5SubBotForSQLite/releases) page and upload it to the server
Windows: Start `E5SubBot.exe` in `cmd`
@ -72,40 +75,19 @@ Linux Systemd:
- download file
```bash
wget https://github.com/rainerosion/E5SubBot/releases/download/0.2.1/E5SubBot_linux_x64.tar.gz
wget https://github.com/rainerosion/E5SubBotForSQLite/releases/download/0.2.2/E5SubBot-linux-amd64.tar.gz
# Unzip file
tar xvjf E5SubBot_linux_x64.tar.gz
# create folder
mkdir /opt/e5sub
# move file
# Move file
mv ./E5SubBot /opt/e5sub/E5SubBot
# Add execution permission
chmod a+x /opt/e5sub/E5SubBot
# Modify configuration file
vim /opt/e5sub/config.yml
```
- Edit service file
```bash
vim /etc/systemd/system/e5sub.service
```
- Copy the following text
```reStructuredText
[Unit]
Description=Telegram E5Sub Bot
[Service]
Type=simple
WorkingDirectory=/opt/e5sub
ExecStart=/opt/e5sub/E5SubBot
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
# Download Systemd unit file
sudo wget -O /etc/systemd/system/e5sub.service https://raw.githubusercontent.com/rainerosion/E5SubBotForSQLite/master/e5sub.service
```
- Start service
@ -143,6 +125,7 @@ errlimit: 5
cron: "1 */3 * * *"
bindmax: 3
dbfile: "e5sub.db"
lang: zh_CN
```
`bindmax`, `notice`, `admin`, `errlimit` can be hot updated, just update `config.yml` to save.
@ -156,7 +139,7 @@ dbfile: "e5sub.db"
|cron|API call frequency, using `cron` expression|
|bindmax|Maximum number of bindable|
|dbfile|Database file|
|lang|Simplified Chinese(default)`zh_CN` English:`en_US`|
### Command
```
/my View bound account information

View File

@ -46,15 +46,18 @@ Bot创建教程:[Google](https://www.google.com/search?q=telegram+Bot%E5%88%9B%E
### Docker部署
```bash
wget --no-check-certificate -O /root/config.yml https://raw.githubusercontent.com/rainerosion/E5SubBot/master/config.yml.example
mkdir /opt/e5sub
# (重要)创建数据库文件
touch /opt/e5sub/e5sub.db
wget --no-check-certificate -O /opt/e5sub/config.yml https://raw.githubusercontent.com/rainerosion/E5SubBotForSQLite/master/config.yml.example
# 修改配置文件中的信息
vim /root/config.yml
docker run -d -v /root/config.yml:/root/config.yml --restart=always --name e5bot rainerosion/e5subbot-sqlite
vim /opt/e5sub/config.yml
docker run -d -v /opt/e5sub/config.yml:/root/config.yml -v /opt/e5sub/e5sub.db:/root/e5sub.db --restart=always --name e5bot rainerosion/e5subbot-sqlite
```
### 二进制文件
在[Releases](https://github.com/rainerosion/E5SubBot/releases)页面下载对应系统的二进制文件,上传至服务器
在[Releases](https://github.com/rainerosion/E5SubBotForSQLite/releases)页面下载对应系统的二进制文件,上传至服务器
Windows: 在`cmd`中启动 `E5SubBot.exe`
@ -64,12 +67,12 @@ Linux(方法一):
chmod a+x E5SubBot
nohup ./E5SubBot > /tmp/e5sub.log &
```
Linux守护进程(适用于Centos)
Linux守护进程(Systemd)
- 下载文件
- 下载相关文件
```bash
wget https://github.com/rainerosion/E5SubBot/releases/download/0.2.1/E5SubBot_linux_x64.tar.gz
wget https://github.com/rainerosion/E5SubBotForSQLite/releases/download/0.2.2/E5SubBot-linux-amd64.tar.gz
# 解压文件
tar xvjf E5SubBot_linux_x64.tar.gz
# 创建文件夹
@ -80,29 +83,8 @@ mv ./E5SubBot /opt/e5sub/E5SubBot
chmod a+x /opt/e5sub/E5SubBot
# 编辑配置文件(文件内容请阅读部署配置)
vim /opt/e5sub/config.yml
```
- 编辑systemd文件
```bash
vim /etc/systemd/system/e5sub.service
```
- 复制以下内容填入上述文件
```reStructuredText
[Unit]
Description=Telegram E5Sub Bot
[Service]
Type=simple
WorkingDirectory=/opt/e5sub
ExecStart=/opt/e5sub/E5SubBot
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
# 下载Systemd unit文件
sudo wget -O /etc/systemd/system/e5sub.service https://raw.githubusercontent.com/rainerosion/E5SubBotForSQLite/master/e5sub.service
```
- 重载配置启动服务
@ -140,6 +122,7 @@ errlimit: 5
cron: "1 */3 * * *"
bindmax: 3
dbfile: "e5sub.db"
lang: zh_CN
```
`bindmax`,`notice`,`admin`,`errlimit`可热更新,直接更新`config.yml`保存即可
@ -153,6 +136,7 @@ dbfile: "e5sub.db"
|cron|API调用频率使用cron表达式|
|bindmax|最大可绑定数|
|dbfile|sqlite数据库文件名|
|lang|简体中文(默认)`zh_CN` English:`en_US`|
### 命令
```

View File

@ -6,3 +6,4 @@ errlimit: 5
cron: "1 */3 * * *"
bindmax: 3
dbfile: "e5sub.db"
lang: zh_CN

View File

@ -190,7 +190,11 @@ func SignTask() {
UnbindUserStr = UnbindUserStr + ubu + "\n"
}
for _, a := range admin {
chat, _ := bot.ChatByID(strconv.FormatInt(a, 10))
chat, err := bot.ChatByID(strconv.FormatInt(a, 10))
if err != nil {
logger.Println(err)
continue
}
bot.Send(chat, gettext.Gettext("taskFeedbackAdmin")+time.Now().Format("2006-01-02 15:04:05")+gettext.Gettext("result")+strconv.Itoa(signOk)+"/"+strconv.Itoa(num)+gettext.Gettext("wrongAccount")+ErrUserStr+gettext.Gettext("clearingAccount")+UnbindUserStr)
}
fmt.Println("----Task End----")

12
e5sub.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Telegram E5Sub Bot
[Service]
Type=simple
WorkingDirectory=/opt/e5sub
ExecStart=/opt/e5sub/E5SubBot
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target

View File

@ -5,7 +5,7 @@ const jsonData = `{
"LC_MESSAGES": {
"resources.json": [{
"msgid" : "helpContent",
"msgstr" : ["命令:\n/my 查看已绑定账户信息\n/bind 绑定新账户\n/unbind 解绑账户\n/export 导出账户信息(JSON格式)\n/help 帮助\n/task 手动执行一次任务(管理员)\n/log 获取最近日志文件(管理员)\n源代码https://github.com/rainerosion/E5SubBot\n原作者https://github.com/iyear/E5SubBot"]
"msgstr" : ["命令:\n/my 查看已绑定账户信息\n/bind 绑定新账户\n/unbind 解绑账户\n/export 导出账户信息(JSON格式)\n/help 帮助\n/task 手动执行一次任务(管理员)\n/log 获取最近日志文件(管理员)\n源代码https://github.com/rainerosion/E5SubBotForSQLite\n原作者https://github.com/iyear/E5SubBot"]
},{
"msgid" : "welcome",
"msgstr" : ["欢迎使用E5SubBot!"]
@ -113,7 +113,7 @@ const jsonData = `{
"LC_MESSAGES": {
"resources.json": [{
"msgid" : "helpContent",
"msgstr" : ["/my View bound account information\n/bind Bind new account\n/unbind Unbind account\n/export Export account information (JSON format)\n/help help\n/task Manually execute a task (Bot Administrator)\n/log Get the most recent log file (Bot Administrator)\nSource Codehttps://github.com/rainerosion/E5SubBot\nOriginal Authorhttps://github.com/iyear/E5SubBot"]
"msgstr" : ["/my View bound account information\n/bind Bind new account\n/unbind Unbind account\n/export Export account information (JSON format)\n/help help\n/task Manually execute a task (Bot Administrator)\n/log Get the most recent log file (Bot Administrator)\nSource Codehttps://github.com/rainerosion/E5SubBotForSQLite\nOriginal Authorhttps://github.com/iyear/E5SubBot"]
},{
"msgid" : "welcome",
"msgstr" : ["Welcome to E5SubBot!"]