models stuff

This commit is contained in:
jude
2020-08-22 01:24:12 +01:00
parent e69264d726
commit 81e339c796
4 changed files with 95 additions and 21 deletions

View File

@ -10,7 +10,10 @@ use serenity::{
framework::standard::CommandResult,
};
use crate::SQLPool;
use crate::{
models::ChannelData,
SQLPool,
};
#[command]
#[supports_dm(false)]
@ -19,7 +22,17 @@ async fn blacklist(ctx: &Context, msg: &Message, args: String) -> CommandResult
let pool = ctx.data.read().await
.get::<SQLPool>().cloned().expect("Could not get SQLPool from data");
if
let mut channel = ChannelData::from_id(msg.channel(&ctx), pool.clone()).await.unwrap();
channel.blacklisted = !channel.blacklisted;
channel.commit_changes(pool).await;
if channel.blacklisted {
}
else {
}
Ok(())
}