Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
My mom's laptop doesn't have format on save and I miss it 😅
  • Loading branch information
kangalio committed Jul 28, 2022
1 parent 2d23ee7 commit 2d88d13
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
38 changes: 30 additions & 8 deletions src/reply/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ impl ReplyHandle<'_> {
pub async fn into_message(self) -> Result<serenity::Message, serenity::Error> {
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"),
}
}
Expand All @@ -63,8 +69,16 @@ impl ReplyHandle<'_> {
pub async fn message(&self) -> Result<Cow<'_, serenity::Message>, 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"),
Expand Down Expand Up @@ -100,15 +114,23 @@ 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);
b
})
.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);
Expand Down
6 changes: 3 additions & 3 deletions src/reply/send_reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<crate::ReplyHandle<'_>, 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?,
})
}
Expand Down

0 comments on commit 2d88d13

Please sign in to comment.