diff --git a/src/framework/commands/messages.rs b/src/framework/commands/messages.rs index 63e7a80..a762231 100644 --- a/src/framework/commands/messages.rs +++ b/src/framework/commands/messages.rs @@ -8,7 +8,7 @@ use twilight_model::channel::Message; use twilight_model::channel::message::{Component as TwilightComponent, Embed}; use twilight_model::http::interaction::{InteractionResponse, InteractionResponseType}; use twilight_model::id::Id; -use twilight_model::id::marker::{ChannelMarker, InteractionMarker}; +use twilight_model::id::marker::{ChannelMarker, InteractionMarker, MessageMarker}; use twilight_util::builder::InteractionResponseDataBuilder; use crate::framework::interactions::components::{ActionRow, Component}; @@ -21,6 +21,7 @@ pub struct MessageSender { content: Option, embeds: Vec, + reply_to: Option>, // Row index, component components: Vec<(u8, Arc>)>, @@ -37,6 +38,7 @@ where rt, content: None, components: vec![], + reply_to: None, embeds: vec![], } } @@ -59,6 +61,12 @@ where self } + pub fn reply_to(mut self, message_id: Id) -> Self { + self.reply_to = Some(message_id); + + self + } + pub async fn send(self) -> Result, Error> { let mut builder = self.rt.http.create_message(self.channel_id); @@ -100,6 +108,10 @@ where builder = builder.components(&rows); builder = builder.embeds(&self.embeds); + if let Some(reply_to) = self.reply_to { + builder = builder.reply(reply_to); + } + let result = builder.await; if result.is_err() { diff --git a/src/groups/about/commands.rs b/src/groups/about/commands.rs index fdbd08c..f624a81 100644 --- a/src/groups/about/commands.rs +++ b/src/groups/about/commands.rs @@ -103,6 +103,7 @@ impl Command for CodeOfConductCommand { ) -> Result<(), CommandError> { ctx.send() .content("") + .reply_to(ctx.event.id) .await?; Ok(()) @@ -139,7 +140,10 @@ impl Command for DonateCommand { ctx: CommandContext<'_, State, Extras>, _args: &str, ) -> Result<(), CommandError> { - ctx.send().content("").await?; + ctx.send() + .reply_to(ctx.event.id) + .content("") + .await?; Ok(()) }