Skip to content

Commit

Permalink
fix: fix message interaction deprecation
Browse files Browse the repository at this point in the history
Signed-off-by: Sefa Eyeoglu <[email protected]>
  • Loading branch information
Scrumplex committed Nov 26, 2024
1 parent 51225c5 commit 9e78f07
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/handlers/event/delete_on_reaction.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use eyre::{Context as _, Result};
use log::trace;
use poise::serenity_prelude::{Context, InteractionType, Reaction};
use poise::serenity_prelude::{Context, MessageInteractionMetadata, Reaction};

pub async fn handle(ctx: &Context, reaction: &Reaction) -> Result<()> {
let user = reaction
Expand All @@ -13,11 +13,10 @@ pub async fn handle(ctx: &Context, reaction: &Reaction) -> Result<()> {
.await
.wrap_err("Couldn't fetch message from reaction!")?;

if let Some(interaction) = &message.interaction {
if interaction.kind == InteractionType::Command
&& interaction.user == user
&& reaction.emoji.unicode_eq("❌")
{
if let Some(MessageInteractionMetadata::Command(metadata)) =
message.interaction_metadata.as_deref()
{
if metadata.user != user && reaction.emoji.unicode_eq("❌") {
trace!("Deleting our own message at the request of {}", user.tag());
message.delete(ctx).await?;
}
Expand Down

0 comments on commit 9e78f07

Please sign in to comment.