diff options
Diffstat (limited to 'src/util/mod.rs')
| -rw-r--r-- | src/util/mod.rs | 21 |
1 files changed, 18 insertions, 3 deletions
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<U, E>( } #[inline] -pub async fn react(ctx: PoiseContext<'_>, react: ReactionType) -> anyhow::Result<Reaction> { - 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<ReactionType> + Send, +) -> anyhow::Result<Reaction> { + 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<ReactionType> + Send, +) -> anyhow::Result<()> { + msg(ctx).ok_or_else(|| anyhow::anyhow!("elp"))?.delete_reaction(ctx, None, react).await?; + Ok(()) } pub async fn send_result( |
