Skip to content

Commit

Permalink
Merge pull request #7 from TorstenCScholz/fsb-6
Browse files Browse the repository at this point in the history
FSB-6 Fix saying goodbye when user in diff. voice channel changes state
  • Loading branch information
TorstenCScholz authored Sep 8, 2016
2 parents 9cfa6b9 + 6153cd6 commit c4d495d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,18 @@ fn main() {
if let Some(channel_id) = voice_state.channel_id {
if channel_id == voice_channel_id {
if !voice_users.contains(&user_id) {
// User joined
voice_users.insert(user_id);

say_hello(&discord, &user_id, &status_channel_id, &mut connection, &server_id);
}
} else {
voice_users.remove(&user_id);
if voice_users.contains(&user_id) {
// User in observed voice channel left
voice_users.remove(&user_id);

say_goodbye(&discord, &user_id, &status_channel_id, &mut connection, &server_id);
say_goodbye(&discord, &user_id, &status_channel_id, &mut connection, &server_id);
}
}
} else {
// Only say goodbye if the user was prev. known to us (that is he/she was in our observed voice channel)
Expand Down

0 comments on commit c4d495d

Please sign in to comment.