guild data caching

This commit is contained in:
2021-04-12 22:33:02 +01:00
parent 72a976dea8
commit 0a9624d12d
9 changed files with 214 additions and 222 deletions

View File

@ -12,10 +12,8 @@ use serenity::{
use std::fmt;
use crate::{
command_help, get_ctx_data,
models::{GuildData, UserData},
};
use crate::models::CtxGuildData;
use crate::{command_help, get_ctx_data, models::UserData};
use sqlx::MySqlPool;
use std::convert::TryFrom;
@ -233,7 +231,7 @@ DELETE FROM todos WHERE user_id = (SELECT id FROM users WHERE user = ?) AND guil
let (pool, lm) = get_ctx_data(&ctx).await;
let user_data = UserData::from_user(&msg.author, &ctx, &pool).await.unwrap();
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx).await;
let prefix = ctx.prefix(msg.guild_id).await;
match subcommand {
SubCommand::View => {
@ -426,7 +424,7 @@ async fn show_help(ctx: &Context, msg: &Message, target: Option<TodoTarget>) {
let (pool, lm) = get_ctx_data(&ctx).await;
let language = UserData::language_of(&msg.author, &pool);
let prefix = GuildData::prefix_from_id(msg.guild_id, &ctx);
let prefix = ctx.prefix(msg.guild_id);
let command = match target {
None => "todo",