feat: wip

This commit is contained in:
Max batleforc 2025-05-27 20:44:41 +02:00
parent c5a35ff5d0
commit a03cb86f7a
No known key found for this signature in database
GPG Key ID: 25D243AB4B6AC9E7

View File

@ -2,7 +2,7 @@ use std::sync::Arc;
use clickhouse_pool::pool_manager::PoolManager; use clickhouse_pool::pool_manager::PoolManager;
use event::event_handler; use event::event_handler;
use poise::serenity_prelude::GatewayIntents; use poise::serenity_prelude::{GatewayIntents, Http};
use tracing::info; use tracing::info;
use trivia::trivia; use trivia::trivia;
use utility::{age::age, help::help, server::servers}; use utility::{age::age, help::help, server::servers};
@ -23,7 +23,7 @@ pub struct Data {
pub type Error = Box<dyn std::error::Error + Send + Sync>; 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 start_bot(config: Config, datalake_config: Arc<PoolManager>) { pub async fn start_bot(config: Config, datalake_config: Arc<PoolManager>) -> Arc<Http> {
let intents = GatewayIntents::GUILD_MESSAGES let intents = GatewayIntents::GUILD_MESSAGES
| GatewayIntents::DIRECT_MESSAGES | GatewayIntents::DIRECT_MESSAGES
| GatewayIntents::MESSAGE_CONTENT | GatewayIntents::MESSAGE_CONTENT
@ -59,8 +59,16 @@ pub async fn start_bot(config: Config, datalake_config: Arc<PoolManager>) {
}) })
}) })
.build(); .build();
let client = poise::serenity_prelude::ClientBuilder::new(token, intents) let mut client = match poise::serenity_prelude::ClientBuilder::new(token, intents)
.framework(framework) .framework(framework)
.await; .await
client.unwrap().start().await.unwrap(); {
Ok(client) => client,
Err(e) => {
panic!("Failed to create client: {}", e);
}
};
let http = client.http.clone();
client.start().await.unwrap();
http
} }