parent
34bc901916
commit
814a789d9c
@ -1,10 +1,11 @@
|
||||
// Tokio async crap
|
||||
|
||||
use poise::serenity_prelude as serenity;
|
||||
const SLOP_SCOUNDREL_SERVER_ID: u64 = 752667089155915846;
|
||||
const SLOP_SCOUNDREL_ROLE_ID: u64 = 1508961172223951078;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::settings::*;
|
||||
|
||||
use poise::serenity_prelude::{self as serenity, FullEvent, RoleId};
|
||||
|
||||
// Data passed to every command (shared state)
|
||||
pub struct Data {}
|
||||
|
||||
@ -15,13 +16,31 @@ pub type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||
pub type Context<'a> = poise::Context<'a, Data, Error>;
|
||||
|
||||
pub async fn event_handler(
|
||||
_ctx: &serenity::Context,
|
||||
_event: &serenity::FullEvent,
|
||||
ctx: &serenity::Context,
|
||||
event: &serenity::FullEvent,
|
||||
_framework: poise::FrameworkContext<'_, Data, Error>,
|
||||
_data: &Data,
|
||||
) -> Result<(), Error> {
|
||||
// Future event handling will go here
|
||||
// Data will contain the database connection
|
||||
|
||||
match &event {
|
||||
&FullEvent::Message { new_message } => {
|
||||
if new_message.guild_id.unwrap() == SLOP_SCOUNDREL_SERVER_ID {
|
||||
if new_message
|
||||
.author
|
||||
.has_role(
|
||||
ctx.http.clone(),
|
||||
new_message.guild_id.unwrap(),
|
||||
RoleId::new(SLOP_SCOUNDREL_ROLE_ID),
|
||||
)
|
||||
.await
|
||||
.unwrap() && !new_message.attachments.is_empty()
|
||||
{
|
||||
new_message.channel_id.say(ctx.http.clone(), "kys").await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -1,2 +1 @@
|
||||
#[allow(dead_code)]
|
||||
const SLOP_SCOUNDREL_ROLE_ID: u64 = 1508961172223951078;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user