From 3e5d6a56b0e155f32fb4718f814d40e942eed119 Mon Sep 17 00:00:00 2001 From: Aron Heinecke Date: Fri, 10 Sep 2021 19:18:34 +0200 Subject: [PATCH] Expose more ts connection options Signed-off-by: Aron Heinecke --- credentials.example.toml | 12 ++++++++++-- src/main.rs | 13 ++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/credentials.example.toml b/credentials.example.toml index 897f51b..046b931 100644 --- a/credentials.example.toml +++ b/credentials.example.toml @@ -4,10 +4,18 @@ discord_token = "SECRET" teamspeak_server = "IP:PORT" # NO tsdns # identity, should change this 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_name = "voice bridge" + # logging stuff, 0-3 verbose = 1 # currently unused diff --git a/src/main.rs b/src/main.rs index b636c4c..a7ef947 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,9 @@ struct Config { discord_token: String, teamspeak_server: String, teamspeak_identity: String, - teamspeak_channel: i32, + teamspeak_channel_id: Option, + teamspeak_channel_name: Option, + teamspeak_channel_password: Option, teamspeak_name: Option, /// default 0 verbose: i32, @@ -180,6 +182,15 @@ async fn main() -> Result<()> { if let Some(name) = config.teamspeak_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. let id = Identity::new_from_str(&config.teamspeak_identity).expect("Can't load identity!");