initial commit
This commit is contained in:
31
src/discord/mod.rs
Normal file
31
src/discord/mod.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
mod commands;
|
||||
mod events;
|
||||
pub mod utils;
|
||||
|
||||
use poise::FrameworkBuilder;
|
||||
use utils::serenity;
|
||||
|
||||
use commands::add_logging_channel;
|
||||
use utils::{BotData, Context, Error};
|
||||
|
||||
pub async fn make_bot() -> color_eyre::Result<FrameworkBuilder<BotData, Error>>
|
||||
{
|
||||
let framework = poise::Framework::builder()
|
||||
.options(poise::FrameworkOptions {
|
||||
commands: vec![add_logging_channel()],
|
||||
..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?)
|
||||
})
|
||||
});
|
||||
Ok(framework)
|
||||
}
|
||||
Reference in New Issue
Block a user