removed some duped code

This commit is contained in:
jude committed 2020-12-18 11:46:22 +00:00
1 parent fd4acc4b9d
commit 26825ff4e5
5 files changed
+65 -283

No files matched your search

+21
View File
@@ -322,3 +322,24 @@ pub async fn check_subscription_on_message(
false
}
}
pub async fn get_ctx_data(ctx: &&Context) -> (MySqlPool, Arc<LanguageManager>) {
let pool;
let lm;
{
let data = ctx.data.read().await;
pool = data
.get::<SQLPool>()
.cloned()
.expect("Could not get SQLPool");
lm = data
.get::<LanguageManager>()
.cloned()
.expect("Could not get LanguageManager");
}
(pool, lm)
}