Crate ts3_query[−][src]
Expand description
Ts3 query library
Small, bare-metal ts query lib without any callback support currently.
A connectivity checking wrapper is available under managed when enabling its feature.
Examples
Simple auth + clients of a server group
use ts3_query::*; let mut client = QueryClient::new("localhost:10011")?; client.login("serveradmin", "password")?; client.select_server_by_port(9987)?; let group_clients = client.servergroup_client_cldbids(7)?; println!("Got clients in group 7: {:?}",group_clients); client.logout()?;
Cloning a channel
use ts3_query::*; let mut client = QueryClient::new("localhost:10011")?; client.login("serveradmin", "password")?; client.select_server_by_port(9987)?; let channels = client.channels_full()?; if let Some(channel) = channels.first() { client.create_channel(&ChannelEdit { channel_name: Some("Cloned channel".to_owned()), ..ChannelEdit::from(channel) })?; }
Using the raw interface for setting client descriptions.
use ts3_query::*; let mut client = QueryClient::new("localhost:10011")?; client.login("serveradmin", "password")?; client.select_server_by_port(9987)?; // escape things like string args, not required for clid // as it's not user input/special chars in this case let cmd = format!("clientedit clid={} client_description={}", 7, raw::escape_arg("Some Description!") ); // we don't expect any value returned let _ = client.raw_command(&cmd)?; client.logout()?;
Raw interface example retrieving online client names
use ts3_query::*; use std::collections::HashSet; let mut client = QueryClient::new("localhost:10011")?; client.login("serveradmin", "password")?; client.select_server_by_port(9987)?; let mut res = raw::parse_multi_hashmap(client.raw_command("clientlist")?, false); let names = res .into_iter() .map(|mut e| e.remove("client_nickname") // ignore empty value & unescape .unwrap().map(raw::unescape_val) // may want to catch this in a real application .unwrap()) .collect::<HashSet<String>>(); println!("{:?}",names); client.logout()?;
Modules
managed | managed Managed connection module. Handles reconnection and name uniqueness. Wraps a normal query connection with health checks. Handles renaming and claimed names. Useful if running long-lasting connections which tend to break over the wire. |
raw | Module with helpers for raw-calls |
Structs
Channel | |
ChannelEdit | This struct defines the values of a channel that are changeable The difference to ChannelFull is that this does not contain values that are not changeable like |
ChannelFull | |
ErrorResponse | Server error response |
OnlineClient | |
OnlineClientFull | |
QueryClient | Ts3 Query client with active connection |
ServerGroup | Server Group returned from |
Enums
ChannelLife | This defines when/if the channel gets automatically removed |
MessageTarget | Target for message sending |
Ts3Error |
Constants
LIMIT_LINE_BYTES | Default DoS limit for read bytes per line |
LIMIT_READ_LINES | Default DoS limit for read lines |
Type Definitions
ChannelGroupId | |
ChannelId | |
ClientDBId | Server interal ID for client, not it’s Identity / MyTeamspeak ID. |
ClientId | Temporary, per connection ID of a client, reused upon disconnect. |
IconHash | CRC32 checksum of the channel icon, but received as i64 instead of u64, except when using |
ServerGroupID | |
ServerId |