31 lines
1 KiB
Rust
31 lines
1 KiB
Rust
use poise::serenity_prelude as serenity;
|
|
|
|
mod commands;
|
|
|
|
struct Data {} // User data, which is stored and accessible in all command invocations
|
|
type Error = Box<dyn std::error::Error + Send + Sync>;
|
|
type Context<'a> = poise::Context<'a, Data, Error>;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
let token = dotenv::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN");
|
|
let intents = serenity::GatewayIntents::non_privileged();
|
|
|
|
let framework = poise::Framework::builder()
|
|
.options(poise::FrameworkOptions {
|
|
commands: vec![commands::fun::ping::ping(), commands::fun::roll::roll()],
|
|
..Default::default()
|
|
})
|
|
.setup(|ctx, _ready, framework| {
|
|
Box::pin(async move {
|
|
poise::builtins::register_globally(ctx, &framework.options().commands).await?;
|
|
Ok(Data {})
|
|
})
|
|
})
|
|
.build();
|
|
|
|
let client = serenity::ClientBuilder::new(token, intents)
|
|
.framework(framework)
|
|
.await;
|
|
client.unwrap().start().await.unwrap();
|
|
}
|