From d10bfcc333be88392536f533f2645d90e1e970d5 Mon Sep 17 00:00:00 2001 From: mii Date: Mon, 31 Oct 2022 12:46:59 +0000 Subject: [PATCH] fix database, borrow --- .gitignore | 3 ++- src/database/database.rs | 2 +- src/events/voice_state_update.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0935315..f38627d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ Cargo.lock config.toml credentials.json /audio -*.mp3 \ No newline at end of file +*.mp3 +*.swp diff --git a/src/database/database.rs b/src/database/database.rs index 3720426..4e08763 100644 --- a/src/database/database.rs +++ b/src/database/database.rs @@ -18,7 +18,7 @@ impl Database { &mut self, user_id: u64, ) -> redis::RedisResult> { - if let Ok(connection) = self.client.get_connection() { + if let Ok(mut connection) = self.client.get_connection() { let config: String = connection .get(format!("discord_user:{}", user_id)) .unwrap_or_default(); diff --git a/src/events/voice_state_update.rs b/src/events/voice_state_update.rs index 53e128f..e6015b7 100644 --- a/src/events/voice_state_update.rs +++ b/src/events/voice_state_update.rs @@ -18,7 +18,7 @@ pub async fn voice_state_update( old: Option, new: VoiceState, ) { - if new.member.unwrap().user.bot { + if new.member.clone().unwrap().user.bot { return; } let guild_id = guild_id.unwrap();