feat: add message logger

This commit is contained in:
seth 2023-12-07 22:18:36 -05:00
parent 8376c45c2d
commit 7e96bced41
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
3 changed files with 101 additions and 2 deletions

View file

@ -0,0 +1,25 @@
use color_eyre::eyre::{Context as _, Result};
use poise::serenity_prelude::{Context, InteractionType, Reaction};
pub async fn handle(ctx: &Context, reaction: &Reaction) -> Result<()> {
let user = reaction
.user(ctx)
.await
.wrap_err_with(|| "Couldn't fetch user from reaction!")?;
let message = reaction
.message(ctx)
.await
.wrap_err_with(|| "Couldn't fetch message from reaction!")?;
if let Some(interaction) = &message.interaction {
if interaction.kind == InteractionType::ApplicationCommand
&& interaction.user == user
&& reaction.emoji.unicode_eq("")
{
message.delete(ctx).await?;
}
}
Ok(())
}