create guild in database

This commit is contained in:
jellywx 2020-12-22 14:28:18 +00:00
parent bfc48a986d
commit 392e1bb65e

View File

@ -351,15 +351,17 @@ impl Framework for RegexFramework {
else if let (Some(guild), Some(Channel::Guild(channel))) = else if let (Some(guild), Some(Channel::Guild(channel))) =
(msg.guild(&ctx).await, msg.channel(&ctx).await) (msg.guild(&ctx).await, msg.channel(&ctx).await)
{ {
let data = ctx.data.read().await;
let pool = data
.get::<SQLPool>()
.cloned()
.expect("Could not get SQLPool from data");
GuildData::from_guild(guild, &pool).await;
if let Some(full_match) = self.command_matcher.captures(&msg.content) { if let Some(full_match) = self.command_matcher.captures(&msg.content) {
if check_prefix(&ctx, &guild, full_match.name("prefix")).await { if check_prefix(&ctx, &guild, full_match.name("prefix")).await {
let data = ctx.data.read().await;
let pool = data
.get::<SQLPool>()
.cloned()
.expect("Could not get SQLPool from data");
let lm = data.get::<LanguageManager>().unwrap(); let lm = data.get::<LanguageManager>().unwrap();
let language = UserData::language_of(&msg.author, &pool).await; let language = UserData::language_of(&msg.author, &pool).await;