parent
34bc901916
commit
814a789d9c
@ -1,10 +1,11 @@
|
|||||||
// Tokio async crap
|
const SLOP_SCOUNDREL_SERVER_ID: u64 = 752667089155915846;
|
||||||
|
const SLOP_SCOUNDREL_ROLE_ID: u64 = 1508961172223951078;
|
||||||
use poise::serenity_prelude as serenity;
|
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use crate::settings::*;
|
use crate::settings::*;
|
||||||
|
|
||||||
|
use poise::serenity_prelude::{self as serenity, FullEvent, RoleId};
|
||||||
|
|
||||||
// Data passed to every command (shared state)
|
// Data passed to every command (shared state)
|
||||||
pub struct Data {}
|
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 type Context<'a> = poise::Context<'a, Data, Error>;
|
||||||
|
|
||||||
pub async fn event_handler(
|
pub async fn event_handler(
|
||||||
_ctx: &serenity::Context,
|
ctx: &serenity::Context,
|
||||||
_event: &serenity::FullEvent,
|
event: &serenity::FullEvent,
|
||||||
_framework: poise::FrameworkContext<'_, Data, Error>,
|
_framework: poise::FrameworkContext<'_, Data, Error>,
|
||||||
_data: &Data,
|
_data: &Data,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
// Future event handling will go here
|
// Future event handling will go here
|
||||||
// Data will contain the database connection
|
// 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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,2 +1 @@
|
|||||||
#[allow(dead_code)]
|
|
||||||
const SLOP_SCOUNDREL_ROLE_ID: u64 = 1508961172223951078;
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user