Compare commits

..

No commits in common. "master" and "v0.2.2" have entirely different histories.

7 changed files with 63 additions and 56 deletions

View File

@ -1,9 +0,0 @@
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,19 +48,16 @@ Bot creation tutorial : [Microsoft](https://docs.microsoft.com/en-us/azure/bot-s
### Docker
```bash
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
wget --no-check-certificate -O /root/config.yml https://raw.githubusercontent.com/rainerosion/E5SubBot/master/config.yml.example
# Modify configuration file
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
vim /root/config.yml
docker run -d -v /root/config.yml:/root/config.yml --restart=always --name e5bot rainerosion/e5subbot-sqlite
```
### Binary Deployment
Download the binary files of the corresponding system on the [Releases](https://github.com/rainerosion/E5SubBotForSQLite/releases) page and upload it to the server
Download the binary files of the corresponding system on the [Releases](https://github.com/rainerosion/E5SubBot/releases) page and upload it to the server
Windows: Start `E5SubBot.exe` in `cmd`
@ -75,19 +72,40 @@ Linux Systemd:
- download file
```bash
wget https://github.com/rainerosion/E5SubBotForSQLite/releases/download/0.2.2/E5SubBot-linux-amd64.tar.gz
wget https://github.com/rainerosion/E5SubBot/releases/download/0.2.1/E5SubBot_linux_x64.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
# Download Systemd unit file
sudo wget -O /etc/systemd/system/e5sub.service https://raw.githubusercontent.com/rainerosion/E5SubBotForSQLite/master/e5sub.service
```
- 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
```
- Start service
@ -125,7 +143,6 @@ 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.
@ -139,7 +156,7 @@ lang: zh_CN
|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,18 +46,15 @@ Bot创建教程:[Google](https://www.google.com/search?q=telegram+Bot%E5%88%9B%E
### Docker部署
```bash
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
wget --no-check-certificate -O /root/config.yml https://raw.githubusercontent.com/rainerosion/E5SubBot/master/config.yml.example
# 修改配置文件中的信息
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
vim /root/config.yml
docker run -d -v /root/config.yml:/root/config.yml --restart=always --name e5bot rainerosion/e5subbot-sqlite
```
### 二进制文件
在[Releases](https://github.com/rainerosion/E5SubBotForSQLite/releases)页面下载对应系统的二进制文件,上传至服务器
在[Releases](https://github.com/rainerosion/E5SubBot/releases)页面下载对应系统的二进制文件,上传至服务器
Windows: 在`cmd`中启动 `E5SubBot.exe`
@ -67,12 +64,12 @@ Linux(方法一):
chmod a+x E5SubBot
nohup ./E5SubBot > /tmp/e5sub.log &
```
Linux守护进程(Systemd)
Linux守护进程(适用于Centos)
- 下载相关文件
- 下载文件
```bash
wget https://github.com/rainerosion/E5SubBotForSQLite/releases/download/0.2.2/E5SubBot-linux-amd64.tar.gz
wget https://github.com/rainerosion/E5SubBot/releases/download/0.2.1/E5SubBot_linux_x64.tar.gz
# 解压文件
tar xvjf E5SubBot_linux_x64.tar.gz
# 创建文件夹
@ -83,8 +80,29 @@ mv ./E5SubBot /opt/e5sub/E5SubBot
chmod a+x /opt/e5sub/E5SubBot
# 编辑配置文件(文件内容请阅读部署配置)
vim /opt/e5sub/config.yml
# 下载Systemd unit文件
sudo wget -O /etc/systemd/system/e5sub.service https://raw.githubusercontent.com/rainerosion/E5SubBotForSQLite/master/e5sub.service
```
- 编辑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
```
- 重载配置启动服务
@ -122,7 +140,6 @@ errlimit: 5
cron: "1 */3 * * *"
bindmax: 3
dbfile: "e5sub.db"
lang: zh_CN
```
`bindmax`,`notice`,`admin`,`errlimit`可热更新,直接更新`config.yml`保存即可
@ -136,7 +153,6 @@ lang: zh_CN
|cron|API调用频率使用cron表达式|
|bindmax|最大可绑定数|
|dbfile|sqlite数据库文件名|
|lang|简体中文(默认)`zh_CN` English:`en_US`|
### 命令
```

View File

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

View File

@ -190,11 +190,7 @@ func SignTask() {
UnbindUserStr = UnbindUserStr + ubu + "\n"
}
for _, a := range admin {
chat, err := bot.ChatByID(strconv.FormatInt(a, 10))
if err != nil {
logger.Println(err)
continue
}
chat, _ := bot.ChatByID(strconv.FormatInt(a, 10))
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----")

View File

@ -1,12 +0,0 @@
[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/E5SubBotForSQLite\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/E5SubBot\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/E5SubBotForSQLite\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/E5SubBot\nOriginal Authorhttps://github.com/iyear/E5SubBot"]
},{
"msgid" : "welcome",
"msgstr" : ["Welcome to E5SubBot!"]