p4bl0t/src/discord/mod.rs

30 lines
826 B
Rust
Raw Normal View History

2023-11-22 20:38:21 +00:00
mod commands;
mod events;
pub mod utils;
use poise::FrameworkBuilder;
use utils::serenity;
use commands::logging;
2023-11-22 20:38:21 +00:00
use utils::{BotData, Context, Error};
pub fn make_bot() -> FrameworkBuilder<BotData, Error> {
poise::Framework::builder()
2023-11-22 20:38:21 +00:00
.options(poise::FrameworkOptions {
commands: vec![logging()],
2023-11-22 20:38:21 +00:00
..Default::default()
})
.token(std::env::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN"))
.intents(serenity::GatewayIntents::non_privileged())
.setup(|ctx, _ready, framework| {
Box::pin(async move {
poise::builtins::register_globally(
ctx,
&framework.options().commands,
)
.await?;
Ok(BotData::new().await?)
})
})
2023-11-22 20:38:21 +00:00
}