Crates.io | sparkle-convenience |
lib.rs | sparkle-convenience |
version | 0.16.0-rc.3 |
source | src |
created_at | 2022-11-18 12:54:35.698149 |
updated_at | 2023-08-15 19:26:38.717003 |
description | A wrapper over Twilight designed to make it more convenient to use |
homepage | |
repository | https://github.com/laralove143/sparkle-convenience/ |
max_upload_size | |
id | 717871 |
size | 71,375 |
This version isn't unstable, but it includes breaking changes. It will be published as non-RC when Twilight publishes its next version so that the version of this crate follows Twilight's version
A wrapper over Twilight that's designed to be convenient to use, without relying on callbacks and mostly following Twilight patterns while making your life easier
let bot = Bot::new(
"forgot to leak my token".to_owned(),
Intents::empty(),
EventTypeFlags::INTERACTION_CREATE,
)
.await?;
let handle = bot.interaction_handle(&interaction);
if interaction.name().ok()? == "pay_respects" {
handle.defer(DeferVisibility::Ephemeral).await?;
handle.check_permissions(Permissions::MANAGE_GUILD)?;
let very_respected_user = interaction.data.ok()?.command().ok()?.target_id.ok()?;
handle
.reply(
Reply::new()
.ephemeral()
.content("Paying respects".to_owned()),
)
.await?;
handle
.reply(
Reply::new()
.ephemeral()
.update_last()
.content(format!("<@{very_respected_user}> has +1 respect now")),
)
.await?;
}
anyhow
: Pulls the anyhow
crate to provide convenience features around it in the error
moduleFeature Requests? Bugs? Support? Contributions? You name it, I'm always looking for community feedback from anyone who uses my work!
If you have a question, join Twilight's Discord server please