fix: fix message interaction deprecation
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
51225c5956
commit
9e78f07015
1 changed files with 5 additions and 6 deletions
|
@ -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
|
||||
|
@ -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?;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue