Wip commit
This commit is contained in:
24
src/main.rs
24
src/main.rs
@ -23,9 +23,12 @@ use std::{
|
||||
|
||||
use chrono_tz::Tz;
|
||||
use log::{error, warn};
|
||||
use poise::serenity_prelude::model::{
|
||||
gateway::GatewayIntents,
|
||||
id::{GuildId, UserId},
|
||||
use poise::serenity_prelude::{
|
||||
model::{
|
||||
gateway::GatewayIntents,
|
||||
id::{GuildId, UserId},
|
||||
},
|
||||
ClientBuilder,
|
||||
};
|
||||
use sqlx::{MySql, Pool};
|
||||
use tokio::sync::{broadcast, broadcast::Sender, RwLock};
|
||||
@ -36,7 +39,6 @@ use crate::{
|
||||
event_handlers::listener,
|
||||
hooks::all_checks,
|
||||
models::command_macro::CommandMacro,
|
||||
utils::register_application_commands,
|
||||
};
|
||||
|
||||
type Database = MySql;
|
||||
@ -213,11 +215,10 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
|
||||
.map(|t| t.timezone.parse::<Tz>().unwrap())
|
||||
.collect::<Vec<Tz>>();
|
||||
|
||||
poise::Framework::builder()
|
||||
.token(discord_token)
|
||||
let framework = poise::Framework::builder()
|
||||
.setup(move |ctx, _bot, framework| {
|
||||
Box::pin(async move {
|
||||
register_application_commands(ctx, framework, None).await.unwrap();
|
||||
poise::builtins::register_globally(ctx, &framework.options().commands).await?;
|
||||
|
||||
let kill_tx = tx.clone();
|
||||
let kill_recv = tx.subscribe();
|
||||
@ -261,9 +262,12 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
|
||||
})
|
||||
})
|
||||
.options(options)
|
||||
.intents(GatewayIntents::GUILDS)
|
||||
.run_autosharded()
|
||||
.await?;
|
||||
.build();
|
||||
|
||||
let mut client =
|
||||
ClientBuilder::new(&discord_token, GatewayIntents::GUILDS).framework(framework).await?;
|
||||
|
||||
client.start_autosharded().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user