From c9e6b2e681088687f5a714c3324d4d0731b8393e Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Fri, 16 Aug 2024 02:53:45 -0400 Subject: better unrecognized handling, more expressive react/unreact indicators --- src/util/mod.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/util/mod.rs') diff --git a/src/util/mod.rs b/src/util/mod.rs index 5b943fe..fb4b552 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -131,9 +131,24 @@ pub async fn reply( } #[inline] -pub async fn react(ctx: PoiseContext<'_>, react: ReactionType) -> anyhow::Result { - let react = msg(ctx).ok_or_else(|| anyhow::anyhow!("elp"))?.react(ctx, react).await?; - Ok(react) +pub async fn react( + ctx: PoiseContext<'_>, + react: impl Into + Send, +) -> anyhow::Result { + msg(ctx) + .ok_or_else(|| anyhow::anyhow!("elp"))? + .react(ctx, react) + .await + .map_err(anyhow::Error::from) +} + +#[inline] +pub async fn unreact( + ctx: PoiseContext<'_>, + react: impl Into + Send, +) -> anyhow::Result<()> { + msg(ctx).ok_or_else(|| anyhow::anyhow!("elp"))?.delete_reaction(ctx, None, react).await?; + Ok(()) } pub async fn send_result( -- cgit v1.3.1