| Crates.io | ataraxy |
| lib.rs | ataraxy |
| version | 0.1.1 |
| created_at | 2022-03-31 01:34:11.755541+00 |
| updated_at | 2022-04-05 01:54:45.456603+00 |
| description | Discord slash commands framework for Serenity |
| homepage | |
| repository | https://github.com/ImpossibleReality/ataraxy |
| max_upload_size | |
| id | 559454 |
| size | 47,588 |

Discord slash commands framework for Serenity inspired by Poise
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!