feat(event/mod): adding the database into ready event
This commit is contained in:
parent
5ffb334130
commit
a26a21964d
1 changed files with 3 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
pub mod bot;
|
||||
include!("./mod_gen.rs");
|
||||
|
||||
use crate::commands::SlashCommand;
|
||||
use serenity::all::*;
|
||||
|
|
@ -8,7 +8,7 @@ use sqlx::PgPool;
|
|||
pub trait BotEvent: Send + Sync {
|
||||
fn event_type(&self) -> &'static str;
|
||||
|
||||
async fn on_ready(&self, _ctx: &Context, _ready: &Ready, _commands: &[Box<dyn SlashCommand>]) {}
|
||||
async fn on_ready(&self, _ctx: &Context, _ready: &Ready, _commands: &[Box<dyn SlashCommand>], _db: &PgPool) {}
|
||||
async fn on_interaction_create(
|
||||
&self,
|
||||
_ctx: &Context,
|
||||
|
|
@ -43,7 +43,7 @@ pub struct Bot {
|
|||
impl EventHandler for Bot {
|
||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
for event in self.events.iter().filter(|e| e.event_type() == "ready") {
|
||||
event.on_ready(&ctx, &ready, &self.commands).await;
|
||||
event.on_ready(&ctx, &ready, &self.commands, &self.database).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue