From 6c858abb0a04079d57c3aa44fcce5fb029afa8ef Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 12 Feb 2026 23:20:10 +0100 Subject: [PATCH] feat(events/mod): adding the database to events --- src/events/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/events/mod.rs b/src/events/mod.rs index 0871fd2..ed6b79d 100644 --- a/src/events/mod.rs +++ b/src/events/mod.rs @@ -2,6 +2,7 @@ pub mod bot; use crate::commands::SlashCommand; use serenity::all::*; +use sqlx::PgPool; #[serenity::async_trait] pub trait BotEvent: Send + Sync { @@ -13,6 +14,7 @@ pub trait BotEvent: Send + Sync { _ctx: &Context, _interaction: &Interaction, _commands: &[Box], + _db: &PgPool, ) { } async fn on_message(&self, _ctx: &Context, _msg: &Message) {} @@ -34,6 +36,7 @@ pub fn import() -> Vec> { pub struct Bot { pub commands: Vec>, pub events: Vec>, + pub database: PgPool, } #[serenity::async_trait] @@ -51,7 +54,7 @@ impl EventHandler for Bot { .filter(|e| e.event_type() == "interaction_create") { event - .on_interaction_create(&ctx, &interaction, &self.commands) + .on_interaction_create(&ctx, &interaction, &self.commands, &self.database) .await; } }