diff options
| author | Jokler <jokler@protonmail.com> | 2020-01-28 03:04:58 +0100 |
|---|---|---|
| committer | Jokler <jokler@protonmail.com> | 2020-01-29 20:39:27 +0100 |
| commit | 985d6bd787c07ea65804d5c079537fb8d805075f (patch) | |
| tree | ff8afb047d6292566189ca0ebaf8740bbc658f71 /src/teamspeak.rs | |
| parent | 09fc3800030b971da8c68217c22f5a0444d7b278 (diff) | |
| download | pokebot-985d6bd787c07ea65804d5c079537fb8d805075f.tar.gz pokebot-985d6bd787c07ea65804d5c079537fb8d805075f.zip | |
Block bots from joining channels with other bots
Diffstat (limited to 'src/teamspeak.rs')
| -rw-r--r-- | src/teamspeak.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/teamspeak.rs b/src/teamspeak.rs index 5dd80ba..b429869 100644 --- a/src/teamspeak.rs +++ b/src/teamspeak.rs @@ -115,10 +115,14 @@ impl TeamSpeakConnection { tokio::run(send_packet); } - pub fn channel_path_of_user(&self, id: ClientId) -> String { + pub fn channel_of_user(&self, id: ClientId) -> Option<ChannelId> { + Some(self.conn.lock().clients.get(&id)?.channel) + } + + pub fn channel_path_of_user(&self, id: ClientId) -> Option<String> { let conn = self.conn.lock(); - let channel_id = conn.clients.get(&id).expect("can find poke sender").channel; + let channel_id = conn.clients.get(&id)?.channel; let mut channel = conn .channels @@ -142,7 +146,7 @@ impl TeamSpeakConnection { path.push_str(name); } - path + Some(path) } pub fn my_channel(&self) -> ChannelId { |
