🔨
This commit is contained in:
parent
59c5d19a59
commit
1e550b3f52
@ -15,25 +15,26 @@
|
||||
镜像地址:ugeek/telegram-cli
|
||||
|
||||
- 安装镜像:
|
||||
```
|
||||
``` sh
|
||||
docker create --name telegram-cli -e TZ=Asia/Shanghai -v 挂载本地目录:/root/.telegram-cli ugeek/telegram-cli:amd64
|
||||
```
|
||||
- 启动docker:
|
||||
```
|
||||
``` sh
|
||||
docker start telegram-cli
|
||||
```
|
||||
- 执行telegram-cli命令行交互(先执行一次登陆,输入telegram注册的手机号码,号码记得加区号。)
|
||||
```
|
||||
``` sh
|
||||
docker exec -it telegram-cli telegram-cli -N -W
|
||||
```
|
||||
- 以下为编译安装步骤(docker或者编译二选一即可):
|
||||
|
||||
- 克隆telegram-cli:
|
||||
```
|
||||
``` sh
|
||||
cd /root/work/telegram ### 或者你自己想要存放的目录
|
||||
git clone --recursive https://github.com/vysheng/tg.git && cd tg
|
||||
- 编译安装
|
||||
```
|
||||
- 编译安装
|
||||
``` sh
|
||||
### ubuntu
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make
|
||||
@ -41,10 +42,10 @@
|
||||
make
|
||||
```
|
||||
如果编译安装出现如下错误:
|
||||
telegram-cil-error.png
|
||||
[telegram-cil-error.png][telegram-cil-error.png]
|
||||
|
||||
解决方法:
|
||||
```
|
||||
``` sh
|
||||
apt-get install -y libgcrypt20-dev libssl-dev
|
||||
./configure --disable-openssl --prefix=/usr CFLAGS="$CFLAGS -w"
|
||||
make
|
||||
@ -52,25 +53,25 @@
|
||||
|
||||
### 申请Telegram APP Key并且登陆telegram-cli
|
||||
- 首先到telegram-apps里申请一个telegram App key(登陆时电话号码记得加国际区号)。
|
||||
telegram-app-login.png
|
||||
[telegram-app-login.png][telegram-app-login.png]
|
||||
|
||||
- 复制Public keys:
|
||||
app-key.png
|
||||
[app-key.png][app-key.png]
|
||||
|
||||
- 创建一个文件保存Public keys:
|
||||
```
|
||||
``` sh
|
||||
nano /root/work/telegram/bot_key.pub
|
||||
###鼠标右键粘贴
|
||||
ctrl+o ##保存 按完记得敲车键
|
||||
ctrl+x ##退出
|
||||
```
|
||||
- 登陆telegram-cil
|
||||
```
|
||||
``` sh
|
||||
/root/work/telegram/tg/bin/telegram-cli -k /root/work/telegram/bot_key.pub
|
||||
###输入账号绑定的手机号码,记得加区号
|
||||
###输入telegram App收到的验证码
|
||||
```
|
||||
telegram-cil-login.png
|
||||
[telegram-cil-login.png][telegram-cil-login.png]
|
||||
|
||||
IOS锁屏就会提示offline,打开手机telegram app就会提示online。
|
||||
|
||||
@ -78,7 +79,7 @@ IOS锁屏就会提示offline,打开手机telegram app就会提示online。
|
||||
telegram-cil频道名称如果有空格用下划线代替。
|
||||
发送命令格式`/root/work/telegram/tg/bin/telegram-cli -W -e "msg 频道名称 命令"`
|
||||
|
||||
```
|
||||
``` sh
|
||||
### 发送一条统计当前互助码池命令
|
||||
/root/work/telegram/tg/bin/telegram-cli -W -e "msg Turing_Lab_Bot /count_activity_codes"
|
||||
```
|
||||
@ -87,7 +88,7 @@ IOS锁屏就会提示offline,打开手机telegram app就会提示online。
|
||||
|
||||
## 编写脚本
|
||||
把互助码准备好,编写脚本:
|
||||
```
|
||||
``` sh
|
||||
### 创建一个文件,保存脚本
|
||||
nano /root/work/telegram/submit_activity_codes.sh
|
||||
```
|
||||
@ -96,7 +97,7 @@ nano /root/work/telegram/submit_activity_codes.sh
|
||||
2021-03-08 优化了定时任务脚本,速度更快,不会中断了,之前的脚本有问题,会经常中断(原因是因为脚本中执行发送消息命令太快-W参数加载消息会话列表没有完成就已经发出命令,导致命令出错!)。
|
||||
|
||||
复制以下内容,互助码自己替换,其他活动互助码自己添加(多个互助码用&拼接):
|
||||
```
|
||||
``` sh
|
||||
#!/bin/bash
|
||||
|
||||
telegramPath=TG Path #记得替换你telegram-cli目录/xxx/tg/bin
|
||||
@ -135,23 +136,23 @@ telegramPath=TG Path #记得替换你telegram-cli目录/xxx/tg/bin
|
||||
docker 用户将最后一行脚本替换成`) | docker exec -i telegram-cli telegram-cli -N`,删除`telegramPath=TG Path #记得替换你telegram-cli目录/xxx/tg/bin`即可
|
||||
|
||||
保存脚本
|
||||
```
|
||||
``` sh
|
||||
ctrl+o ##保存 按完记得敲回车键
|
||||
ctrl+x ##退出
|
||||
```
|
||||
赋予脚本可执行权限
|
||||
```
|
||||
``` sh
|
||||
chmod +x /root/work/telegram/submit_activity_codes.sh
|
||||
```
|
||||
测试的时候记得注释大部分命令,留一到两个就行了,频繁提交小心被Bot Ban号。
|
||||
```
|
||||
``` sh
|
||||
bash /root/work/telegram/submit_activity_codes.sh
|
||||
```
|
||||
看看手机接收到的通知,一般接收到通知无非就是提交成功或助力池已满。
|
||||
|
||||
## 添加crontab定时任务
|
||||
助力池每次清空日期为每月1,8,16,24号,延迟10分钟后执行:
|
||||
```
|
||||
``` sh
|
||||
crontab -e
|
||||
10 0 1,8,16,24 * * bash /root/work/telegram/submit_activity_codes.sh
|
||||
```
|
||||
@ -163,3 +164,9 @@ crontab -e
|
||||
> 版权属于: orzlee
|
||||
> 本文链接: https://www.orzlee.com/toss/2021/02/24/lxk0301-jingdong-signin-scriptautomatic-submission-of-mutual-aid-codes.html
|
||||
> 作品采用: 《 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 》许可协议授权
|
||||
|
||||
|
||||
[telegram-cil-error.png]:https://github.com/Oreomeow/VIP/blob/main/Icons/TGbash/telegram-cil-error.png
|
||||
[telegram-app-login.png]:https://github.com/Oreomeow/VIP/blob/main/Icons/TGbash/telegram-app-error.png
|
||||
[app-key.png]:https://github.com/Oreomeow/VIP/blob/main/Icons/TGbash/app-key.png
|
||||
[telegram-cil-login.png]https://github.com/Oreomeow/VIP/blob/main/Icons/TGbash/telegram-cil-login.png
|
||||
|
||||
Loading…
Reference in New Issue
Block a user