Code Monkey home page Code Monkey logo

pytson's Introduction

Build Status Gitter chat PayPal

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
  • 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.

pytson's People

Contributors

bluscream avatar pathmann avatar svenpaulsen avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.