Skip to content

This is a python module with useful functions for using the Teamspeak Client Query

Notifications You must be signed in to change notification settings

FlorianSteenbuck/TeamspeakClientQueryAPIpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is a python module with useful functions for using the Teamspeak Client Query

Quick Start

Its simple like that you import the api module

#Import the api module
import api

And then you can use all functions
To start the a connection to the Teamspeak Client Query you simply can run the function teamspeak_socket_init and get the return variable

#Import the api module
import api

#Create a connection to the current client query
ts3clientquery = api.teamspeak_socket_init()

In the next step you can use this variable to send and receive something from your clientquery data.
In this example we change your nickname for that we need the teamspeak_socket_send function

#Import the api module
import api

#Create a connection to the current client query
ts3clientquery = api.teamspeak_socket_init()

'''
Here we use the teamspeak_socket_send function with 
clientupdate command and set with parameter client_nickname
the nickname and escape this nickname
with the teamspeak_escape function
'''
print(api.teamspeak_socket_send(ts3clientquery,"clientupdate client_nickname=".api.teamspeak_escape("I am Stupid")))

After you send all what you want the best way to end your program is to use the close function

#Import the api module
import api

#Create a connection to the current client query
ts3clientquery = api.teamspeak_socket_init()

'''
Here we use the teamspeak_socket_send function with 
clientupdate command and set with parameter client_nickname
the nickname and escape this nickname
with the teamspeak_escape function
'''
print(api.teamspeak_socket_send(ts3clientquery,"clientupdate client_nickname=".api.teamspeak_escape("I am Stupid")))

#Close the clientquery
ts3clientquery.close()

Functions

teamspeak_socket_init
teamspeak_socket_send

teamspeak_socket_init

Description

def teamspeak_socket_init(clientquery_port=25639):

This is a Function that initalize a local socket connection to the teamspeak client query and gets and print the first 3 lines of the response.

Parameters

clientquery_port
The Client Query must be a Integer. If not set it is using the default port for the clientquery(25639).

Return Values

This Function return a simple raw socket for a connection to the teamspeak client query.

Examples

#Create a connection to the current client query
ts3query = api.teamspeak_socket_init()
#Create a connection to the current client query with a custom port
ts3query = api.teamspeak_socket_init(12058)

Changelog

No Changes

teamspeak_socket_send

Description

def teamspeak_socket_send(socket,command):

This function use the pre initalized socket (teamspeak_socket_init) to send some command to the client query.

Parameters

socket
The Client Query Socket must be a raw tcp socket connection. I recommend to use the teamspeak_socket_init function, because you maybe get trouble with getting data from the response stream.

command
The Command must be a String without "\n". I recommend to use the tool.py to find out more about the commands.

Return Values

This Function return the next line of the response after sending the command.

Examples

#Create a connection to the current client query
ts3query = api.teamspeak_socket_init()

#Send the Command to Change the nickname to "IamStupid"
api.teamspeak_socket_send(ts3query,"clientupdate client_nickname=IamStupid")

Changelog

No Changes

About

This is a python module with useful functions for using the Teamspeak Client Query

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages