Make p.co and p.d reply to the user
This commit is contained in:
@@ -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<T, E> {
|
||||
|
||||
content: Option<String>,
|
||||
embeds: Vec<Embed>,
|
||||
reply_to: Option<Id<MessageMarker>>,
|
||||
|
||||
// Row index, component
|
||||
components: Vec<(u8, Arc<dyn Component<T, E>>)>,
|
||||
@@ -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<MessageMarker>) -> Self {
|
||||
self.reply_to = Some(message_id);
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn send(self) -> Result<Response<Message>, 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() {
|
||||
|
||||
Reference in New Issue
Block a user