feat: wip
This commit is contained in:
parent
c5a35ff5d0
commit
a03cb86f7a
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user