mirror of
https://github.com/rainerosion/E5SubBotForSQLite.git
synced 2026-06-03 00:53:42 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba170eb3d7 | ||
| bdfcd71fdb | |||
| 7feaea08da | |||
| f068f53112 | |||
| 628373ce58 | |||
| 64bd4d68f7 | |||
| 5a5c24eeaf | |||
| ad4b39d8dd | |||
|
|
5f98f4de29 | ||
|
|
6384d46dad | ||
|
|
1084e1814a | ||
|
|
4095894f89 | ||
|
|
e62bd1f2f5 |
9
.drone.yml
Normal file
9
.drone.yml
Normal 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
|
||||
43
README.md
43
README.md
@ -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
|
||||
|
||||
@ -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`|
|
||||
|
||||
### 命令
|
||||
```
|
||||
|
||||
@ -6,3 +6,4 @@ errlimit: 5
|
||||
cron: "1 */3 * * *"
|
||||
bindmax: 3
|
||||
dbfile: "e5sub.db"
|
||||
lang: zh_CN
|
||||
@ -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
12
e5sub.service
Normal 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
|
||||
@ -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 Code:https://github.com/rainerosion/E5SubBot\nOriginal Author:https://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 Code:https://github.com/rainerosion/E5SubBotForSQLite\nOriginal Author:https://github.com/iyear/E5SubBot"]
|
||||
},{
|
||||
"msgid" : "welcome",
|
||||
"msgstr" : ["Welcome to E5SubBot!"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user