This commit is contained in:
Stachelbeere1248 2024-10-14 00:15:34 +02:00
parent 0514afd32f
commit e0d50f68bc
Signed by: Stachelbeere1248
SSH key fingerprint: SHA256:IozEKdw2dB8TZxkpPdMxcWSoWTIMwoLaCcZJ1AJnY2o
6 changed files with 461 additions and 412 deletions

837
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@ env_logger = "0.11.3"
anyhow = "1.0.86" anyhow = "1.0.86"
tracing = "0.1.40" tracing = "0.1.40"
regex = "1.10.4" regex = "1.10.4"
sqlx = { version = "0.7.4" , features = ["sqlite", "sqlx-sqlite", "runtime-tokio"]} sqlx = { version = "0.8.2", features = ["sqlite", "sqlx-sqlite", "runtime-tokio"]}
reqwest = { version = "0.12.5" } reqwest = { version = "0.12.5" }
serde = { version = "1.0.203", features = ["derive"] } serde = { version = "1.0.203", features = ["derive"] }
serde_json = { version = "1.0.119" } serde_json = { version = "1.0.119" }

24
src/handlers/message.rs Normal file
View file

@ -0,0 +1,24 @@
use serenity::all::{Context, Message};
use crate::Error;
pub(crate) async fn create(ctx: &Context, msg: &Message) -> Result<(), Error> {
match msg.guild_id.map(|g| g.get()) {
None => Ok(()),
Some(1256217633959841853_u64) => {
zmp_create(ctx, msg).await
},
_ => Ok(())
}
}
async fn zmp_create(ctx: &Context, msg: &Message) -> Result<(), Error> {
match msg.channel_id.get() {
1295108216388325386_u64 => {
msg.react(ctx, '🇼').await?;
msg.react(ctx, '🇱').await?;
Ok(())
},
_ => Ok(())
}
}

View file

@ -1 +1,2 @@
pub(crate) mod bot_interaction; pub(crate) mod bot_interaction;
pub(crate) mod message;

View file

@ -116,6 +116,9 @@ async fn event_handler(
&& interaction.kind() == InteractionType::Component { && interaction.kind() == InteractionType::Component {
handlers::bot_interaction::component(ctx, interaction).await?; handlers::bot_interaction::component(ctx, interaction).await?;
} }
},
FullEvent::Message { new_message } => {
handlers::message::create(ctx, new_message).await?;
} }
_ => {} _ => {}
} }