Expose more ts connection options

Signed-off-by: Aron Heinecke <aron.heinecke@t-online.de>
This commit is contained in:
Aron Heinecke 2021-09-10 19:18:34 +02:00
parent b44dbe7372
commit 3e5d6a56b0
2 changed files with 22 additions and 3 deletions

View file

@ -4,10 +4,18 @@ discord_token = "SECRET"
teamspeak_server = "IP:PORT" # NO tsdns teamspeak_server = "IP:PORT" # NO tsdns
# identity, should change this # identity, should change this
teamspeak_identity = "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI" teamspeak_identity = "MG0DAgeAAgEgAiAIXJBlj1hQbaH0Eq0DuLlCmH8bl+veTAO2+k9EQjEYSgIgNnImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nmDBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI"
# join channel ID
teamspeak_channel = 1 # use either of the following
# join ts-channel by ID
# teamspeak_channel_id = 1
# join ts-channel by name, use / for nesting
# teamspeak_channel_name = "Default Channel/Nested"
# if required use a password
# teamspeak_channel_password = "some password"
# teamspeak nickname # teamspeak nickname
teamspeak_name = "voice bridge" teamspeak_name = "voice bridge"
# logging stuff, 0-3 # logging stuff, 0-3
verbose = 1 verbose = 1
# currently unused # currently unused

View file

@ -38,7 +38,9 @@ struct Config {
discord_token: String, discord_token: String,
teamspeak_server: String, teamspeak_server: String,
teamspeak_identity: String, teamspeak_identity: String,
teamspeak_channel: i32, teamspeak_channel_id: Option<u64>,
teamspeak_channel_name: Option<String>,
teamspeak_channel_password: Option<String>,
teamspeak_name: Option<String>, teamspeak_name: Option<String>,
/// default 0 /// default 0
verbose: i32, verbose: i32,
@ -180,6 +182,15 @@ async fn main() -> Result<()> {
if let Some(name) = config.teamspeak_name { if let Some(name) = config.teamspeak_name {
con_config = con_config.name(name); con_config = con_config.name(name);
} }
if let Some(channel) = config.teamspeak_channel_id {
con_config = con_config.channel_id(tsclientlib::ChannelId(channel));
}
if let Some(channel) = config.teamspeak_channel_name {
con_config = con_config.channel(channel);
}
if let Some(password) = config.teamspeak_channel_password {
con_config = con_config.password(password);
}
// teamspeak: Optionally set the key of this client, otherwise a new key is generated. // teamspeak: Optionally set the key of this client, otherwise a new key is generated.
let id = Identity::new_from_str(&config.teamspeak_identity).expect("Can't load identity!"); let id = Identity::new_from_str(&config.teamspeak_identity).expect("Can't load identity!");