diff options
Diffstat (limited to 'src/handler.rs')
-rw-r--r-- | src/handler.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/handler.rs b/src/handler.rs index 7b4568f..a52b31a 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -1,6 +1,6 @@ use poise::serenity_prelude as serenity; -use crate::models::ReactionRole; +use crate::models::*; use crate::{Data, Error}; use tracing::info; @@ -72,7 +72,20 @@ pub async fn event_handler( } add_reaction.delete(&ctx.http).await?; - } + }, + poise::Event::Message { new_message } => { + let current_user = ctx.http.get_current_user().await?; + + if new_message.author.id.0 != current_user.id.0 { + // This message does *not* belong to the bot + println!("Message from not-bot"); + let filters = sqlx::query_as::<_, MessageFilter>( + "SELECT * FROM message_filter WHERE guild_id=$1") + .bind(new_message.guild_id.unwrap().0.to_string()) + .fetch_all(&pool) + .await?; + } + }, _ => (), } } |