Install telegram-cli in Ubuntu

Install telegram-cli in Ubuntu

JD.com, one of the China’s biggest ecommerce company, offers a lot of ways for customers to sign in the app daily, to keep its popularity. Many programers in China have developed scripts to sign for JD beans and other virtual credits. The most popular repository is https://gitee.com/lxk0301/jd_docker. The app itself encourages users to help each other in some funny games.

Telegram cli benefits in this way to submit exsited scripts in the repository.

$ git clone --recursive https://github.com/vysheng/tg.git && cd tg
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev libzlib1g-dev libssl1.0-dev make 
$ ./configure
$ make
$ ls bin/
generate  telegram-cli  tl-parser
$ cp bin/* ~/.local/bin/
$ sudo mkdir /etc/telegram-cli/
$ sudo cp server.pub /etc/telegram-cli/

Emmm, everything is well. To start with telegram, just input:

$ telegram-cli

And it will allow you to input phone,first name,and last name. Notice that the phone should be in the format of:+86123xxxxx.

The telegram will send a validation code to your account in other logined device, which is also required to input in this very step.

One strategy is to use belowing script to submit interexchagnge codes to a exsiting bot (TuringLabbot) in Telegram:

#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin; export PATH

##### wiki
#互助码每月 1, 8, 16, 24号凌晨0点清空
#支持互助码批量提交(使用 & 隔开)每周期内最多提交同一活动5个互助码,尽量错峰提交。频繁提交,一经发现永ban!
#####

# 向@TuringLabbot提交: 长期 bean farm pet ddfactory jxfactory 短期 sgmh
botname="TuringLabbot"
## 种豆得豆 - bean
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "种豆得豆" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/submit_activity_codes bean $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## 东东农场 - farm
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "东东农场" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/submit_activity_codes farm $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## 东东萌宠
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "东东萌宠" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/submit_activity_codes pet $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## 东东工厂
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "东东工厂" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/submit_activity_codes ddfactory $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## 京喜工厂 - jxfactory
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "京喜工厂" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/submit_activity_codes jxfactory $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## 闪购盲盒 sgmh
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "闪购盲盒" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/submit_activity_codes sgmh $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## 京喜财富岛 jd_cfd.log 
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "京喜财富岛" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/submit_activity_codes jxcfd $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

# 向@LvanLamCommitCodeBot提交: /jdcash - JD签到领现金 /jdcrazyjoy - JD疯狂的小狗 提交助力码 /jdzz - JD赚赚 提交助力码
botname="LvanLamCommitCodeBot"
## /jdcash - JD签到领现金
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "签到领现金" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/jdcash $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## /jdcrazyjoy - JD疯狂的小狗
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "crazyJoy" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/jdcrazyjoy $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

## /jdzz - JD赚赚 提交助力码
sleep $(shuf -i 10-20 -n 1)
codes=$(cat /root/jd_scripts/logs/sharecodeCollection.log | grep "京东赚赚" | grep -oE "[a-zA-Z0-9=_-]+$" | head -n 5 | tr "\n" "&" | sed "s/&$//g")
text="/jdzz $codes"
/usr/bin/telegram-cli -U root -W -e "msg @${botname} ${text}"

The final step is to add a task in the crontab manner:

crontab -e
2 0,1,5 1,8,16,24 * * bash /root/turingbot.sh

Now, enjoy the time that the program running in the cloud, the hands carrying the fragrance of coffee, quietly listening to the music!

Views