TS3Query

Install

In Rails 3, add this to your Gemfile and run the bundle command.

gem "ts3query"

Getting Started

Connecting to a Teamspeak 3 Server

@query = TS3Query.server_connect :address  => "your-address.com" # default => 127.0.0.1
                                 :port     => 1234               # default => 10011
                                 :username => "myqueryuser"      # default => serveradmin
                                 :password => "myquerypassword"

Connecting to a Teamspeak 3 Client (via ClientQuery plugin)

@query = TS3Query.client_connect :address  => "your-address.com" # default => 127.0.0.1
                                 :port     => 1234               # default => 25639

This will raise an ConnectionRefused error, if the client does not respond or the credentials are wrong.

Executing query commands

This retuns a result hash with all server informations.

result = @query.version()

This will return a hash with the serverlist. (Options -uid and -short)

result = @query.serverlist do |opt|
  opt.uid
  opt.short
end

This will select the first server. (Parameters sid=1)

@query.use :sid => 1

You can also combine parameters and options.

@query.use :sid => 1 do |opt|
  opt.virtual
end

Close the connection

If you don’t need the query connection any longer you should close it.

@query.disconnect

Query commands

For a full command reference you can download the Teamspeak 3 Query Manuel.

Contributing to TS3Query

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Running the tests

If you try to run the tests, you need a local teamspeak server running with this data:

  • Address: 127.0.0.1

  • Port: 10011

  • User: serveradmin

  • Password: 0L8awVFD

Copyright © 2012 TnT Web Solutions GbR. See LICENSE.txt for further details.