ataraxy

Crates.ioataraxy
lib.rsataraxy
version0.1.1
sourcesrc
created_at2022-03-31 01:34:11.755541
updated_at2022-04-05 01:54:45.456603
descriptionDiscord slash commands framework for Serenity
homepage
repositoryhttps://github.com/ImpossibleReality/ataraxy
max_upload_size
id559454
size47,588
Johan Novak (ImpossibleReality)

documentation

README

Ataraxy
Discord slash commands framework for Serenity inspired by Poise


Usage

Ataraxy is based off of the #[command] macro, which wraps a function and turns it into a usable command.

/// Says "Hello world"
#[command]
async fn say_hello(
    ctx: Context,
    #[option(channel_type = "text", description = "Text channel to say hello to")]
    channel: ChannelId,
) {
    channel
        .send_message(&ctx.http(), |m| m.content("Hello, world!"))
        .await;
    ctx.reply_ephemeral("Message sent successfully.").await;
}

You can then register commands and command groups to ataraxy's Framework.

let framework = Framework::new().command(test_cmd);

Ataraxy's Framework implements Serenity's EventHandler trait so that you can use it in the serenity Client

let mut client = Client::builder(token)
    .event_handler(framework)
    .application_id(application_id)
    .await
    .expect("Error creating client");

if let Err(why) = client.start().await {
    println!("Client error: {:?}", why);
}

It's as easy as that!

Commit count: 34

cargo fmt