一 下载源文件
这里有两个选择,前面是原版的,后面是接入网易云的,这里选择后者的,但是后者没有网页管理页面,需要手动上传
1. Splamy/TS3AudioBot项目仓库:TS3AudioBot
2.ZHANGTIANYAO1/TS3AudioBot-NetEaseCloudmusic-plugin项目仓库:TS3AudioBot-NetEaseCloudmusic-plugin
下载 TS3AudioBot_linux_x64 文件,上传至服务器/home/TS3AudioBot目录:
可以下载原版的
https://github.com/Splamy/TS3AudioBot/releases/download/0.12.0/TS3AudioBot_linux_x64.tar.gz
也可以下载TS3AudioBot-NetEaseCloudmusic-plugin的3.0.2测试版
https://github.com/ZHANGTIANYAO1/TS3AudioBot-NetEaseCloudmusic-plugin/releases/download/3.0.2/TS3AudioBot_linux_x64.zip
这里推荐直接下载我的https://a.cn-lcx.cn/qSRJI,里面有文件后面要用
在服务端解压
//前者
cd /home/TS3AudioBot
tar -xzvf TS3AudioBot_linux_x64.tar.gz
rm -f TS3AudioBot_linux_x64.tar.gz
//后者
cd /home/TS3AudioBot
unzip TS3AudioBot_linux_x64.zip
rm -f TS3AudioBot_linux_x64.zip
二 运行机器人
安装依赖
sudo apt-get install libopus-dev ffmpeg
运行
chmod +x TS3AudioBot
./TS3AudioBot
输入n
输入服务器地址和密码(如有)
我这里是本地运行且没有密码
连接完成后关闭服务端
此时进入/home/TS3AudioBot文件夹,发现多了很多文件
用新rights里的文件替换现有的
修改rights.toml,填写userid
获取方式如下,打开teamspeak客户端
按以下方式填写
useruid = [ "6qjqqYUTweOKxrQducOAKAmALoc=" ]
之后重新运行bot
./TS3AudioBot
会有一个bot加入频道
私聊bot发送:!api token
打开ip:58913输入token
这样就可以远程管理bot了
三 后台运行
方法一
nohup ./TS3AudioBot &
方法二
#ubuntu
cd /lib/systemd/system
#centos
cd /etc/systemd/system
vi ts3audiobot.service
填写:
[Unit]
Description=TS3AudioBot
After=network.target
[Service]
Type=simple
User=root
KillSignal=SIGINT
RestartSec=15
Restart=always
WorkingDirectory=/home/TS3AudioBot/
ExecStart=/home/TS3AudioBot/TS3AudioBot
[Install]
WantedBy=multi-user.target
如果你不会编辑文件且使用ubuntu系统,可以直接使用以下代码
cat > /lib/systemd/system/ts3audiobot.service << EOF
[Unit]
Description=TS3AudioBot
After=network.target
[Service]
Type=simple
User=root
KillSignal=SIGINT
RestartSec=15
Restart=always
WorkingDirectory=/home/TS3AudioBot/
ExecStart=/home/TS3AudioBot/TS3AudioBot
[Install]
WantedBy=multi-user.target
EOF
#开启自启动
systemctl daemon-reload
systemctl enable ts3audiobot.service
#启停
systemctl start ts3audiobot.service
systemctl stop ts3audiobot.service
#状态
systemctl status ts3audiobot.service
四 使用方法
网页管理端
!api token
创建歌单
!list create 歌单名
将歌曲加入歌单
!list add 歌单名 歌曲路径
查看歌单内的歌曲
!list show 歌单名
播放歌单
!list play 歌单名
如想播放网络歌曲则输入如
!play http://music.163.com/song/media/outer/url?id=1859652717.mp3
播放本地目标则输入如
!play /home/music/music.mp3