pyTSon is a plugin for the TeamSpeak 3 client, it offers a python3 interface for the plugin sdk. pyTSon has a minimum C/C++ part, so that the main plugin runs in embedded python.
Current used python version is Python 3.5.2.
The python standard library is included, either built in the plugin or bundled in the lib directory (which is in sys.path by default). pyTSon has PythonQt included, so that scripts can have UIs written in python, see pyTSon's own configdialog or the scripting console for examples.
pyTSon has multiple layers of dependencies listed below.
- Python3
- epydoc (which is only available for Python2, so we'll switch to another doctool in the future)
- Qt 5.12.1 (which is the version, the TeamSpeak 3 client is currently using)
- Python 3.5.2 (configure with --enable-shared)
- PythonQt
- patchelf (linux; Version >= 0.9)
- None! (At least none you have to care about, python is deployed with the plugin)
- Get the latest release for your Teamspeak client here or compile the source yourself.
- Restart your Teamspeak Client.
- Download or write any pyTSon script and place it in
%APPDATA%\TS3Client\plugins\pyTSon\scripts\<your-plugin-dir>
on windows resp.~/.ts3client/plugins/pyTSon/scripts/<your-plugin-dir>
on unix. - In your client click on "Plugins" => "pyTSon" => "Settings" and on the settings dialog click on "Reload All" and check the plugins checkbox if it's not checked already.
- Adjust the python include and lib path in python.pri or run qmake with
qmake [...] PYTHONPATH=<your-python-path>
- Download/Clone PythonQt from here to includes/
qmake
(n)make
Done
Create a *.py file in <TeamSpeak 3 client install>/plugins/pyTSon/scripts/<your-plugin-dir> with a subclass of ts3plugin. Needed class attributes are requestAutoload, name, version, apiVersion, author, description, offersConfigure, commandKeyword, infoTitle, menuItems, hotkeys. Otherwise pyTSon refuses to load the plugin. See ts3plugin.py or the documentation for a description of each attribute.
On load, pyTSon will create an instance of your class (call the constructor), after that callbacks are called (if available) as methods of the created instance, eg if you were poked, onClientPokeEvent(self, schid, fromClientID, pokerName, pokerUniqueIdentity, message, ffIgnored) will be called. On unload, pyTSon will call stop and delete the instance of your class.
TeamSpeak 3's library functions are available with the ts3lib module (eg err, myid = ts3lib.getClientID(schid)). Constants are available in the ts3defines module (see ts3defines.py in include/ directory).
Below is a small example plugin:
from ts3plugin import ts3plugin
import ts3lib, ts3defines
class testplugin(ts3plugin):
name = "test"
requestAutoload = False
version = "1.0"
apiVersion = 21
author = "Thomas \"PLuS\" Pathmann"
description = "This is a testplugin"
offersConfigure = True
commandKeyword = ""
infoTitle = ""
menuItems = []#[(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT, 0, "text", "icon.png")]
hotkeys = []#[("keyword", "description")]
def __init__(self):
ts3lib.printMessageToCurrentTab("Yay, we are running!")
def stop(self):
ts3lib.printMessageToCurrentTab("Oh no, we were stopped :(")
def onNewChannelEvent(self, schid, channelID, channelParentID):
err, name = ts3lib.getChannelVariableAsString(schid, channelID, ts3defines.ChannelProperties.CHANNEL_NAME)
if err == ts3defines.ERROR_ok:
ts3lib.printMessageToCurrentTab("new channel %s" % name)
else:
ts3lib.printMessageToCurrentTab("got error %s" % err)
pyTSon can load plugins from online repositories. pyTSon master is included by default. Check the Readme for more information, if you want to setup your own.
Personally I work on my linux amd64 machine, other platforms are only tested for basic running, but of course feel free to open an issue, if there is something wrong on your platform and I'll have a look into it.
Check the release page or myteamspeak.com within your client. If you are interested in the most recent version, check this repository for automatic (untested) builds.