创建 Telegram Bot(t.me/BotFather)
服务器安装安装 Aria2
#安装基础组件
apt install wget curl ca-certificates
#下载脚本
wget -N git.io/aria2.sh && chmod +x aria2.sh
#运行脚本
./aria2.sh
下载程序 在releases下载对应平台的可运行文件(https://github.com/gaowanliang/DownloadBot/releases)
wge https://github.com/gaowanliang/DownloadBot/releases/download/v0.0.5/DownloadBot_0.0.5_Linux_x86_64.tar.gz
编辑 config.json 配置文件
uesr-id未知的可以去 t.me/myidbot 获取
nano config.json
配置文件示例
{
"aria2-server": "ws://127.0.0.1:5800/jsonrpc",
"aria2-key": "xxxxxxxx",
"bot-key": "123456789:xxxxxxxxx",
"user-id": "123456789",
"max-index": 10,
"sign": "Main Aria2",
"language": "zh-CN",
"downloadFolder": "C:/aria2/Aria2Data",
"moveFolder":"C:/aria2/GoogleDrive"
}
各项对应解释
- aria2-server:aria2 服务器地址,默认使用 websocket 连接。如果要使用 websocket 连接 aria2,请务必设置 aria2.conf 内的 enable-rpc=true 。如果不是必须,请尽量设置本地的 aria2 地址,以便于最大化的使用本程序
- aria2-key:aria2.conf 中 rpc-secret 的值
- bot-key:Telegram Bot 的标识
- user-id:管理员的 ID
- max-index:下载信息最大显示数量,建议 10 条(以后会改进)
- sign:此机器人的标识,如果需要多个服务器连接同一个机器人,通过这一项可以确定具体是哪一台服务器
- language:机器人输出的语言
- downloadFolder:Aria2 下载文件保存的地址。如果不使用,请输入 ""
- moveFolder: 要将下载文件夹的文件移动到的文件夹。如果不使用,请输入 ""
运行程序
chmod +x ./DownloadBot
./DownloadBot
打开 TG BOT 就会有提示