removed some duped code

This commit is contained in:
2020-12-18 11:46:22 +00:00
parent fd4acc4b9d
commit 26825ff4e5
5 changed files with 65 additions and 283 deletions

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)
}