Skip to content

xDroni/TS3-Music-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TeamSpeak 3 Music Bot

TeamSpeak 3 Music Bot in Node.js with some cool features

Watch the demo: https://streamable.com/crtqz

Features:

  • Music

    • adding songs to the queue
    • adding playlists (with a shuffle option)
    • skipping current song, removing last added song and more
    • getting the title of the current song
    • listing songs in the queue
    • more (see below)
  • Other

    • sending a welcome message with some statistics to every user that joins our server

Installation

Tested with Node 14+ on Linux, Ubuntu. It may also work on Windows, but has not been tested.

You will need Node.js (at least version 14), ffmpeg, TeamSpeak3 Client, libasound2-dev (if on Linux), make, gcc, g++, desktop environment if you don't have one (to launch TS3 Client, I tested gnome).

Install required dependencies (Ubuntu / Debian):

sudo apt-get install ffmpeg libasound2-dev make gcc g++

Install a desktop environment, if you don't have one:

sudo apt-get install ubuntu-gnome-desktop

or another of your choice.

Bot listens for commands using ServerQuery account, so you need to provide login and password. To reset the password, check: https://support.teamspeak.com/hc/en-us/articles/360002712898

Step 1

  • Clone this repo to your local machine:
git clone https://github.com/xDroni/TS3-Music-Bot.git

Step 2

  • Install packages:
npm install

The main dependency (@distube/ytdl-core) is frequently updated. In case of any problems, try npm update @distube/ytdl-core first.

Step 3

  • (optional) Copy your YouTube API key into the config.json file, it's located in the src/ directory. This is not necessary, but may speed up the search slightly.
  • (optional) If you want to play age-restricted videos, fill in the cookiesArray field in config.json, the cookiesString field will be generated automatically. An easy way to get cookiesArray is to sign in to your verified YouTube account and use a plugin like EditThisCookie (tested on Chrome).

Step 4

  • Launch your TeamSpeak 3 Client and connect to the server.

Step 5

  • On the same machine run the music bot with the following parameters (clientname is the name of the user you set in step 4):
npm start host="server_address" login="query_login" password="query_password" botname="MusicBotName" clientname="ClientName"

(optional) Auto-restart bash script (on !exit command or on error)

It will also try to update the main dependency (@distube/ytdl-core)

#!/bin/bash
while true
do
    npm start host="server_address" login="query_login" password="query_password" botname="MusicBotName" clientname="ClientName"
    npm install @distube/ytdl-core@latest
done

If you run the bot with this script, it will automatically restart in case of an unexpected error.

TeamSpeak 3 client capture settings

TS3 Capture Settings

TS3 Capture Settings

(optional part)

My sound settings using PulseEffects with equalizer

ALSA plug-in [node] will appear when you add the song to the queue

Sound settings

Sound settings

Sound settings

Sound settings

Usage

Once you have everything set up, you can start using commands.

Music

Add song to the queue

!play <title or link to the song>

alias: !s and !sr

Add playlist

!playlist <link to the playlist>

alias: !p

Note that the regular queue has priority over the playlist.

Add a playlist and shuffle it

!p m/mix/shuffle <link to the playlist>

You can also shuffle the playlist later using

!m, !mix or !shuffle

List the next 5 songs in the queue / playlist

!list

alias: !l

Get the title of the current song

!current

alias !c

Skip the current song

!skip

Remove the last added song from the queue

!skiplast

alias !sl

Remove all songs from the queue

!skipall

alias !sa

Get the queue length

!size

alias !length

Play the previously played song

!previous

alias: !last

Other

Exit the music bot

!exit

If you run the bot using the auto-restart script, the !exit command will also work as an on-demand restart.

Releases

No releases published

Packages

No packages published