diff --git a/src/reply/mod.rs b/src/reply/mod.rs index 75120cc2f183..cf339f34024d 100644 --- a/src/reply/mod.rs +++ b/src/reply/mod.rs @@ -47,10 +47,16 @@ impl ReplyHandle<'_> { pub async fn into_message(self) -> Result { use ReplyHandleInner::*; match self.0 { - Prefix(msg) | Application { followup: Some(msg), .. } => Ok(*msg), - Application { http, interaction, followup: None } => { - interaction.get_interaction_response(http).await - }, + Prefix(msg) + | Application { + followup: Some(msg), + .. + } => Ok(*msg), + Application { + http, + interaction, + followup: None, + } => interaction.get_interaction_response(http).await, Autocomplete => panic!("reply is a no-op in autocomplete context"), } } @@ -63,8 +69,16 @@ impl ReplyHandle<'_> { pub async fn message(&self) -> Result, serenity::Error> { use ReplyHandleInner::*; match &self.0 { - Prefix(msg) | Application { followup: Some(msg), .. } => Ok(Cow::Borrowed(msg)), - Application { http, interaction, followup: None } => Ok(Cow::Owned( + Prefix(msg) + | Application { + followup: Some(msg), + .. + } => Ok(Cow::Borrowed(msg)), + Application { + http, + interaction, + followup: None, + } => Ok(Cow::Owned( interaction.get_interaction_response(http).await?, )), Autocomplete => panic!("reply is a no-op in autocomplete context"), @@ -100,7 +114,11 @@ impl ReplyHandle<'_> { }) .await?; } - ReplyHandleInner::Application { http, interaction, followup: None } => { + ReplyHandleInner::Application { + http, + interaction, + followup: None, + } => { interaction .edit_original_interaction_response(http, |b| { reply.to_slash_initial_response_edit(b); @@ -108,7 +126,11 @@ impl ReplyHandle<'_> { }) .await?; } - ReplyHandleInner::Application { http, interaction, followup: Some(msg) } => { + ReplyHandleInner::Application { + http, + interaction, + followup: Some(msg), + } => { interaction .edit_followup_message(http, msg.id, |b| { reply.to_slash_followup_response(b); diff --git a/src/reply/send_reply.rs b/src/reply/send_reply.rs index 17264f78342b..366c3284a346 100644 --- a/src/reply/send_reply.rs +++ b/src/reply/send_reply.rs @@ -27,9 +27,9 @@ pub async fn send_reply<'att, U, E>( builder: impl for<'a> FnOnce(&'a mut crate::CreateReply<'att>) -> &'a mut crate::CreateReply<'att>, ) -> Result, serenity::Error> { Ok(match ctx { - crate::Context::Prefix(ctx) => { - crate::ReplyHandle(super::ReplyHandleInner::Prefix(crate::send_prefix_reply(ctx, builder).await?)) - } + crate::Context::Prefix(ctx) => crate::ReplyHandle(super::ReplyHandleInner::Prefix( + crate::send_prefix_reply(ctx, builder).await?, + )), crate::Context::Application(ctx) => crate::send_application_reply(ctx, builder).await?, }) }