Releases: samuelgrant/Teamspeak-GO
Fixed ServerGlobalMessage
v1.0.2 Fixed a variable issue
Allows use of HTTPS & Improves `status.IsSuccess()`
Required Change
- When calling
ConfigureHttpa third paramater 'useHttps` must be added.
HTTP - Web Query
Http Web Query
On February 20, Team Speak developer TS.ChrisR announced that server version 3.12.0 [Beta] would introduce a new Query interface called 'Web Query'. The command structure of the Web Query is like the original query system. Switching to the HTTP system yields several advantages:
-
HTTP can be secured using SSL/HTTPs
-
HTTP queries are faster as each request sends an authorization header.
Previously a minimum of two calls would need to be made, the first would establish a connection, and the second would authenticate the query client with the server.Because we no longer need to make two calls prior to executing the desired query, it will be possible to fire HTTP calls as necessary without creating a pool of available clients..... this means that HTTP is more efficient and resource friendly
-
HTTP queries return json data, this means we can convert it into structs using less code
Breaking Changes
A summary of changes are listed below, for a quick usage guide view the readme
More information can be found in the wiki.
Global
- Changed the following return types on all calls:
*QueryResponseto*status- Status is the name of the object in the JSON response
- Changed
QueryResponse.IsSuccesstostatus.IsSuccess() - Status structs with a code of
-1have been altered by the function and do not reflect the TS Response
- Detached functions from
*net.connthey are now found atfuncName()
Tokens/Privilege Keys
- Fixed the spelling of
Tokenslist()toTokensList()
Virtual Servers
- Replaced
Use()withSelectVirtualServer(sid)- The selected can be changed at any time by using
SelectVirtualServer(sid) - If a virtual server has not been specified
1will be used by default
- The selected can be changed at any time by using
List()has been renamedServersList()
Server/Channel Groups
- Removed unused properties from
ServerGroupandChannelGroupstruts ServerGroupAddClienthas been renamedServerGroupsAddClientServerGroupRemoveClienthas been renamedServerGroupsRevokeClient
ts3.go / Telnet Wrapper
-
Removed
ts3.goand included functions: - this was the Telnet wrapper- Connect
- IsConnected
- Disconnect
- Exec
-
Added
ts3Http.go, the HTTP wrapper.- get('path', isGlobal, queries) is the new Exec function
- isGlobal (bool) - If TRUE the command does not get sent to a specific virtual server
- queries is an array of
KeyValue{}that will be turned into a query string
- get('path', isGlobal, queries) is the new Exec function
Utils
- Encoder/Decoder only convert spaces to
+and vice versa - Added a
WebEncoder- Only to be used if you build your own query strings, the get() function will do this automatically- Converts
(white space) to%20 - Converts
=to%3D
- Converts
- Deleted QueryResponse
- Added function
i64tostr- Converts an int64 to a string
Removed Parse functions
The following parse functions have been removed as json.Unmarshal is being used:
- ParseVirtualServer
- parsePrivilegeKey
+ Server group management functions
Added the following functions
v0.3.3-alpha
Fixed go.mod
Small fixes
- Fixed the package name in
go.mod - Removed
.vscodeI will add an example debugging configuration on the wiki shortly. - Minor tweaks to variable names
Added functions to kick and delete users
Notice: The following functions in user.go have been renamed so their names are in line with the rest of the lib.
FindUserByCustomSearch(ident string, value string)=>UserFindByCustomSearch(ident string, value string)FindUserByDbId(cldbid int64)=>UserFindByDbId(cldbid int64)PokeUser(clid int, msg string)=>UserPoke(clid int, msg string)
New Functions:
-
UserDelete(clid) deletes a user from the server's database. This can be used if you need to delete a user’s custom fields or you wish to revoke all permissions. A user cannot be deleted while connected to the server so this function will first call UserKickClients (see below)
-
UserKickClients(clid, msg) kicks all clients belonging to a specific user
Added channel group commands
Added channel group commands that:
- List all channel groups
- List channel group members for a specific channel
- Set a member’s channel group for a given channel
- Reset a member’s channel group for a given channel
- Poke all members of a channel group
Converted code to a library & Improved command feedback
This release may break your code. If you were using an earlier version check your return types.
The wiki has not been updated to reflect the changes in this release
This release aims to achieve three goals:
-
Convert the code from a stand-alone go project to a library.
- Removed
main.goandfunc main() - Renamed the package of all files from
maintots3
- Removed
-
Improve logging
- Standardise the log format and colour
- Disable logging by default
- Provide a function to enable/disable logging
LoggingEnabled(true) - Ensure that we log when an error occurs with a basic message to indicate the cause of the issue
-
Standardise the response from functions within the lib
- The
Exec()function now returns three params*QueryResponse, body, error - Most functions will now check for errors and query failures after executing a statment for example
- The
res, body, error := client.Exec("serverlist")
if err != nil || !res.IsSucess {
// runtime error or query error occured
// log the issue
// return res, err
}- Made sure that the query response is returned to the function calling it where possible
- Used pointers for return types so that
nilcan be returned
initial release
This code comes with a basic client and the following functions
General
- Connect
- Disconnect
- Login
- Use
- IsConnected
- Exec (Sends commands to the server)
Privilege Keys
- Add
- Remove
- List
Server Commands
- GlobalMessage
- List
- Start
- Stop
ServerGroupss
- ServerGroups (List all server groups)
- ServerGroupsAddClient
- ServerGroupsRemoveClient
- ServerGroupMembers
- ServerGroupPoke
User
- ActiveClients (Lists clients who are connected to the server)
- FindUserByDbId
- FindUserByCustomSearch