master | develop |
---|---|
This is our open-source TeamSpeak 3 audiobot project since
we haven't found any other open-source one so far.
The bot has come a long way is pretty stable by now, though somtimes he hangs up or needs some other maintenance.
For now I'd only recomment this bot on small servers since it doesn't cover any more complex right systems and relies on discipline.
The bot is split up into 2 parts:
- The Main-Bot:
- is processing all your commands via TeamSpeak's serverquery.
- starts the "SeverBob" if music should be played.
- The ServerBob:
- is a plain TeamSpeak3 client with a custom plugin.
- is able to stream to different Channels and/or Users simultaneously with TeamSpeak's whisper feature.
- streams all the music with the awesome ffmpeg library.
Working:
- Extract Youtube and Soundcloud songs as well as stream Twitch
- Extensive history manager, including features like:
- getting the last x played songs
- get last x songs played by a certain user
- start any once played song again via id
- search in title from played songs
- (planned) combined search expressions
- (un)subscribe to the Bob to hear music in any channel
- (un)subscribe the Bob to certain channels
In progress:
- Playlist manager
In planning:
- Create multiple client instances automatically for diffrent channels
- Add plugin support
All in all, the bot is fully operable only via chat (and actually only via chat).
Commands are invoked with !command.
Some commands have restrictions, like they can only be used in a private chat, only in public chat, or need admin rights.
- add: Adds a new song to the queue.
- clear: Removes all songs from the current playlist.
- getuserid: Gets the unique Id of a user.
- help: Shows all commands or detailed help about a specific command.
- history: Shows recently played songs.
- kickme: Guess what?
- link: Gets a close to original link so you can open the original song in youtube, soundcloud, etc.
- loop: Sets whether of not to loop the entire playlist.
- next: Plays the next song in the playlist.
- pm: Requests private session with the ServerBot so you can invoke private commands.
- play: Automatically tries to decide whether the link is a special resource (like youtube) or a direct resource (like ./hello.mp3) and starts it.
- previous: Plays the previous song in the playlist.
- quit: Closes the TS3AudioBot application.
- quiz: Enable to hide the songnames and let your friends guess the title.
- repeat: Sets whether or not to loop a single song
- seek: Jumps to a timemark within the current song.
- song: Tells you the name of the current song.
- soundcloud: Resolves the link as a soundcloud song to play it for you.
- subscribe: Lets you hear the music independent from the channel you are in.
- stop: Stops the current song.
- test: Only for debugging purposes
- twitch: Resolves the link as a twitch stream to play it for you.
- unsubscribe: Only lets you hear the music in active channels again.
- volume: Sets the volume level of the music.
- youtube: Resolves the link as a youtube video to play it for you.
This command will find every link containing something like ?v=Unique_TYID
If the bot can't play a video it might be due to some embedding restrictions, which are blocking this.
For now we don't have any workaround for that.
- For compilation
- A C# Compiler (Visual Studio or mono + xbuild) for the Bot
- A C++ Compiler that supports C++11
- The cmake build system
ffmpeg
(libavcodec, libavformat, libswscale, libavutil, libswresample and libavfilter)
Windows: Included in the dependency package- (optional)
cppunit
for tests - (optional) american fuzzy lop for fuzzying
- For usage
ffmpeg
(same as for compilation except that you don't need the development headers)
Windows: Copy the contents of theDependencies/bin
folder into the TeamSpeak-Client directory (nearts3client_win64.exe
)
Download the git repository with git clone https://github.com/Splamy/TS3AudioBot.git
.
- Install all needed dependencies (e.g. ffmpeg)
- Go into the directory of the repository and execute
xbuild /p:Configuration=Release TS3AudioBot.sln
to build the C# AudioBot. - Go into
TS3AudioBob
and create abin
directory. - Run
cmake ..
from the createdbin
folder (cmake -DCMAKE_BUILD_TYPE=Release ..
to make a release build) - and
make
to build the C++ TeamSpeak plugin.
- Install all needed dependencies
- Download the dependencies package and extract it
into the TS3AudioBob directory (the
Dependencies
folder should be near thesrc
folder).
It contains the assembled dependencies for x64 windows. - Build the C# AudioBot with Visual Studio.
- Go into
TS3AudioBob
and create abin
directory. - Run
cmake-gui ..
from the createdbin
folder (cmake -DCMAKE_BUILD_TYPE=Release ..
to make a release build). - Open and build the created solution with Visual Studio.
- Linux specific: you'll either need a X environment capable of running window applications or install
a virtual X interface like Xvfb.
Our Xvfb one time start looks like this:
Xvfb :1 -screen 0 640x480x24 > /dev/null 2>&1 & disown
Windows specific: Copy the libraries from theDependencies/bin
folder into your TeamSpeak client directory (they should be nearts3client_win64.exe
). - Linux: Create a script called
StartTsBot.sh
and add the containing folder to yourPATH
variable. The scipt should executeexport DISPLAY=:1
and start the ts3client.
Windows: not yet working. - Create 2 groups on the TeamSpeak server:
- one for the ServerBot with enough rights so he can
- join as a serverquery
- view all server/channel/clients
- write in all/private chat
- optionally kick clients form channel/server
- one for the AudioBotAdmin with no requirements (just ensure a high enough
i_group_needed_member_add_power
).
You need to add the Bot to this group so he can communicate with the Bob.
- The first time you'll need to start the TS3Audiobot.exe without parameter and it will ask you a few questions. You can get ServerGroupIds in the rights window.
- Now you can close the bot with the
!quit
command and start it in the background.
- Run the test project of the Bot in Visual Studio or Monodevelop.
- Run
./ts3audiobobtest
in the cmake build folder to test the Bob. - Use
./RunAFL.sh
in the Bob folder to fuzz the Bob command system.