Registry / web-framework / poise
library0.6.1rscratesunverified

A Discord bot framework built on top of serenity, providing command handling and more.

# Cargo.toml [dependencies] poise = "0.6.1"
INSTALL
IMPORT
SIG · POISE
P
poise
web-frameworkrustv0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

serenity
use poise::serenity_prelude as serenity;

Sets up a basic Discord bot with a slash command.

use poise::serenity_prelude as serenity; struct Data {} // User data, can be empty type Error = Box<dyn std::error::Error + Send + Sync>; #[poise::command(slash_command, prefix_command)] async fn age( ctx: poise::Context<'_, Data, Error>, #[description = "Your age"] age: u8, ) -> Result<(), Error> { ctx.say(format!("Your age is {}", age)).await?; Ok(()) } #[tokio::main] async fn main() { let framework = poise::Framework::builder() .options(poise::FrameworkOptions { commands: vec![age()], ..Default::default() }) .token("YOUR_TOKEN") .intents(serenity::GatewayIntents::non_privileged()) .setup(|ctx, _ready, _framework| Box::pin(async move { Ok(Data {}) })); framework.run().await.unwrap(); }
Debug
Known issues
gotchaRequires a tokio runtime; async main needed.
fix
Use #[tokio::main] or another async runtime.
affects: >=0.6.0
Upgrade
Version history
0.6.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
poise — cargo add poise · libregistry