Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/commands/general/delete_interaction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use poise::serenity_prelude::{Message, MessageInteractionMetadata::Command};

use crate::{Context, Error};

#[poise::command(context_menu_command = "Delete command", ephemeral)]
pub async fn delete_interaction(ctx: Context<'_>, message: Message) -> Result<(), Error> {
let Some(Command(interaction)) = message.interaction_metadata.as_deref() else {
ctx.say("❌ This message does not contain a command")
.await?;
return Ok(());
};

if interaction.user.id != ctx.author().id {
ctx.say("❌ You cannot delete commands run by other users")
.await?;
return Ok(());
}

message.delete(ctx).await?;
ctx.say("🗑️ Deleted command!").await?;
Ok(())
}
1 change: 1 addition & 0 deletions src/commands/general/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod delete_interaction;
pub mod help;
pub mod joke;
pub mod members;
Expand Down
1 change: 1 addition & 0 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub type Command = poise::Command<Data, Error>;

pub fn all() -> Vec<Command> {
vec![
general!(delete_interaction),
general!(help),
general!(joke),
general!(members),
Expand Down
26 changes: 0 additions & 26 deletions src/handlers/event/delete_on_reaction.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/handlers/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use poise::serenity_prelude::{ActivityData, Context, FullEvent, OnlineStatus};
use poise::FrameworkContext;

mod analyze_logs;
mod delete_on_reaction;
mod eta;
mod expand_link;
mod give_role;
Expand Down Expand Up @@ -66,16 +65,6 @@ pub async fn handle(
analyze_logs::handle(ctx, new_message, data).await?;
}

FullEvent::ReactionAdd { add_reaction } => {
trace!(
"Received reaction {} on message {} from {}",
add_reaction.emoji,
add_reaction.message_id.to_string(),
add_reaction.user_id.unwrap_or_default().to_string()
);
delete_on_reaction::handle(ctx, add_reaction).await?;
}

FullEvent::ThreadCreate { thread } => {
trace!("Received thread {}", thread.id);
support_onboard::handle(ctx, thread).await?;
Expand Down
Loading