转自:零妖妖柒的博客 http://wyxslh.myds.me:11018/index.php/archives/6/
安装pip命令:
apt-get install zip unzip screen git python3 python3-pip -y
安装rclone:
curl https://rclone.org/install.sh | sudo
安装fclone:
bash <(wget -qO- https://git.io/JJYE0)
安装gclone:
bash <(wget -qO- https://git.io/gclone.sh)
安装机器人:
git clone https://github.com/wrenfairbank/telegram_gcloner
cd到目录:
cd telegram_gcloner
安装依赖:
pip3 install -r requirements.txt
再次cd到目录:
cd telegram_gcloner
复制config:
cp config.ini.example config.ini
编辑config:
nano config.ini
编辑:
只编辑以下
telegram_token = telegram机器人token
user_ids = 你的telegram id(多个以英文逗号隔开,第一个ID为管理员)
运行:python3
python3 telegram_gcloner.py
这时候你的机器人应该上线了,并给你发送了1条信息。然后执行如下命令
如想所有人都用:覆盖文件restricted.py重新运行(路径:/root/telegram_gcloner/telegram_gcloner/utils/restricted.py)
restricted
开机自启动
先退出:
Ctrl+C
创建启动脚本:
cd /root/telegram_gcloner
nano start.sh
输入以下内容,并保存文件。
#! /bin/bash
cd /root/telegram_gcloner/telegram_gcloner
python3 telegram_gcloner.py
赋予权限:
chmod +x start.sh
将以下代码一起复制到SSH运行
cat > /etc/systemd/system/fcboat.service <<EOF
[Unit]
Description=fcboat
After=network.target
[Service]
ExecStart=/root/telegram_gcloner/start.sh
[Install]
WantedBy=multi-user.target
EOF
然后启动服务并设置开机自启
systemctl start fcboat
systemctl enable fcboat
评论
发表评论