Skip to content
forked from pathmann/pyTSon

pyTSon is a plugin for the TeamSpeak 3 client, it offers a python interface for the plugin sdk

License

Notifications You must be signed in to change notification settings

tabiznet/pyTSon

 
 

Repository files navigation

This repository is archived. pyTSon will not work with your up-to-date TeamSpeak 3 client.

Feel free to fork this repository.

pyTSon

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.

Batteries included

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.

Dependencies

pyTSon has multiple layers of dependencies listed below.

Generating Code

Generating Documentation

  • Python3
  • epydoc (which is only available for Python2, so we'll switch to another doctool in the future)

Building

Running

  • None! (At least none you have to care about, python is deployed with the plugin)

How to use

  1. Get the latest release for your Teamspeak client here or compile the source yourself.
  2. Restart your Teamspeak Client.
  3. 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.
  4. 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.

How to build

  • 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

How to develop a python plugin

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)

Repository

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.

Releases

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.

About

pyTSon is a plugin for the TeamSpeak 3 client, it offers a python interface for the plugin sdk

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 35.7%
  • C++ 35.6%
  • C 26.2%
  • Smarty 1.4%
  • Other 1.1%