群晖Synology Docker 搭建 TS3AudioBot

碎碎念:由于在群辉搭建了ts,但是ts本身的保别名机制(当 30 天没有连接活动时,服务器昵称将过期),所以在网上找了很久,想看看有没有什么机器人可以一直挂在频道,于是就看到了ts3AudioBot这个项目,但是我这边没有7*24小时的WIN设备,刚开始是想在群辉里搭建一个WIN虚拟机,来跑机器人,但是遇到了一些问题(系统用的是 LTSC 和 WIN10专业版 但是我在腾讯云 2012 server上搭建反而没出现问题)就放弃了,于是想看看有没有Docker版本,在DockerHub上找到了对应的项目,但是搭建了几天也没有跑起来,遇到了比WIN环境下更多的问题 ,包括但不限于DockerHub的官方文档没有更新,导致了Docker挂载路径错误的问题,Docker版默认没有初始机器人需要手动创建等等问题,由于百度没有任何Docker搭建ts3AudioBot的相关教程,我也没有任何可以参考的地方,一度差点放弃,但是好在我在github上找到了对应的更新文档,以及从 Issues 中找到了一些蛛丝马迹,才得以搭建起这个项目。

PS:如果可以的话 尽可能的吧你的ts服务端和机器人都部署在同一个环境下 这样可以避免上传带宽不足 导致了机器人播放卡顿的问题

搭建之前 请务必保证 Everyone 拥有共享文件夹的 读取 写入 权限

群晖Synology Docker 搭建 TS3AudioBot插图

注册表 搜索 ts3AudioBot

群晖Synology Docker 搭建 TS3AudioBot插图1

运行映像

群晖Synology Docker 搭建 TS3AudioBot插图2

挂载路径 /app/data

网络一定要选 host 否则机器人就只能连接 IPV4 的服务器 如果你想连接 127.0.01 或 IPV6 的服务器 这里一定要改成 host(群辉docker bridge 网络也可以启动 IPV6 但是相对比较麻烦 如果你想机器人挂在 bridge 网络环境下 可以搜索教程 启动 bridge 的 IPV6)

群晖Synology Docker 搭建 TS3AudioBot插图3

找到 rights.toml 文件 编辑群晖Synology Docker 搭建 TS3AudioBot插图4

将 UID 替换到 useruid 里 英文的双引号 ""​群晖Synology Docker 搭建 TS3AudioBot插图5

进入 bots 新建一个名为 default 的文件夹

群晖Synology Docker 搭建 TS3AudioBot插图6

新建一个名为 bot.toml 的文件 将以下代码复制进去 注意修改 address

#Starts the instance when the TS3AudioBot is launched. run = true [commands] [commands.alias] [connect] #The server password. Leave empty for none. server_password = { pw = "" } #The default channel password. Leave empty for none. channel_password = { } #Overrides the displayed version for the ts3 client. Leave empty for default. client_version = { } #The address, ip or nickname (and port; default: 9987) of the TeamSpeak3 server address = "IP + 端口号 例:127.0.0.1:9987 如果想使用 127.0.0.1 请务必将容器运行在 host 上" #Client nickname when connecting. name = "Music Bot" [connect.identity] #||| DO NOT MAKE THIS KEY PUBLIC ||| The client identity. You can import a teamspeak3 identity here too. key = "" #The client identity offset determining the security level. offset = 18 [reconnect] #When a new song starts the volume will be trimmed to between min and max. #When the current volume already is between min and max nothing will happen. #To completely or partially disable this feature, set min to 0 and/or max to 100. volume = { } [playlists] [history] [events]
#Starts the instance when the TS3AudioBot is launched. run = true [commands] [commands.alias] [connect] #The server password. Leave empty for none. server_password = { pw = "" } #The default channel password. Leave empty for none. channel_password = { } #Overrides the displayed version for the ts3 client. Leave empty for default. client_version = { } #The address, ip or nickname (and port; default: 9987) of the TeamSpeak3 server address = "IP + 端口号 例:127.0.0.1:9987 如果想使用 127.0.0.1 请务必将容器运行在 host 上" #Client nickname when connecting. name = "Music Bot" [connect.identity] #||| DO NOT MAKE THIS KEY PUBLIC ||| The client identity. You can import a teamspeak3 identity here too. key = "" #The client identity offset determining the security level. offset = 18 [reconnect]  #When a new song starts the volume will be trimmed to between min and max. #When the current volume already is between min and max nothing will happen. #To completely or partially disable this feature, set min to 0 and/or max to 100. volume = { } [playlists] [history] [events] 
#Starts the instance when the TS3AudioBot is launched. run = true [commands] [commands.alias] [connect] #The server password. Leave empty for none. server_password = { pw = "" } #The default channel password. Leave empty for none. channel_password = { } #Overrides the displayed version for the ts3 client. Leave empty for default. client_version = { } #The address, ip or nickname (and port; default: 9987) of the TeamSpeak3 server address = "IP + 端口号 例:127.0.0.1:9987 如果想使用 127.0.0.1 请务必将容器运行在 host 上" #Client nickname when connecting. name = "Music Bot" [connect.identity] #||| DO NOT MAKE THIS KEY PUBLIC ||| The client identity. You can import a teamspeak3 identity here too. key = "" #The client identity offset determining the security level. offset = 18 [reconnect] #When a new song starts the volume will be trimmed to between min and max. #When the current volume already is between min and max nothing will happen. #To completely or partially disable this feature, set min to 0 and/or max to 100. volume = { } [playlists] [history] [events]

将新建的 bot.toml 放到 default 文件夹

群晖Synology Docker 搭建 TS3AudioBot插图7

重启容器

群晖Synology Docker 搭建 TS3AudioBot插图8

右键机器人 开始文字聊天 输入 !api token 英文的!

群晖Synology Docker 搭建 TS3AudioBot插图9

打开浏览器 输入 群辉的IP + 端口 例:http://192.168.98.208:58913 这里要用http 而不是https

群晖Synology Docker 搭建 TS3AudioBot插图10

在 Client Uid 里 输入 之前和机器人对话生成的 token(如果输入进去 提示 Auth failed 说明 token 里出现了奇怪的东西 比如 笑脸符号 可以重新给机器人发送 !api token 获取新的 token)

群晖Synology Docker 搭建 TS3AudioBot插图11

PS:可以在 ts客户端 点击 权限 -> 权限秘钥 -> 创建

Type:服务器组 Group:Server Admin 点击创建

复制 key 和 机器人对话 输入 !bot setup + key 英文的!

该选项为 选填 主要目的是为了赋予 机器人 管理员权限

PS:如果要给机器人添加 网易云音乐在线播放 请使用以下链接

http://music.163.com/song/media/outer/url?id=2013750367.mp3

把里面的 id 替换成 你想要播放的歌曲的 id 即可

原文链接:https://blog.csdn.net/weixin_43691620/article/details/132506857?ops_request_misc=%257B%2522request%255Fid%2522%253A%25225625c251a574e92afe4e588201b7d445%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=5625c251a574e92afe4e588201b7d445&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-9-132506857-null-null.nonecase&utm_term=%E7%BE%A4%E6%99%96%E6%90%AD%E5%BB%BA

© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享