Added error handling for getting reputation
parent
d3469fb9fb
commit
4184c969a2
21
src/bot.rs
21
src/bot.rs
|
@ -332,7 +332,6 @@ pub mod bot {
|
|||
.await
|
||||
.unwrap();
|
||||
}
|
||||
dbg!(self.database_handle.remove(&author_name).unwrap()); // Removes old data, prevents duplicate entries
|
||||
dbg!(self
|
||||
.spam_db_handle
|
||||
.insert(&author_name, format!("{:?}", data_vec).as_str().as_bytes())
|
||||
|
@ -432,17 +431,19 @@ pub mod bot {
|
|||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let user_data = dbg!(self
|
||||
if let Some(user_data) = dbg!(self
|
||||
.database_handle
|
||||
.get(author.user_id().as_str())
|
||||
.unwrap()
|
||||
.unwrap());
|
||||
|
||||
let (_, reputation) = convert_from_bytes_sled(&user_data);
|
||||
self.send_message(
|
||||
format!("Your current reputation is: {}", reputation).as_str(),
|
||||
)
|
||||
.await;
|
||||
.unwrap()) {
|
||||
let (_, reputation) = convert_from_bytes_sled(&user_data);
|
||||
self.send_message(
|
||||
format!("Your current reputation is: {}", reputation).as_str(),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
else {
|
||||
self.send_message("Error getting reputation").await;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue