Support ephemeral reminder confirmations

This commit is contained in:
jude
2023-05-11 19:40:33 +01:00
parent 4b42966284
commit aa931328b0
8 changed files with 171 additions and 25 deletions

View File

@ -645,7 +645,13 @@ async fn create_reminder(
return Ok(());
}
ctx.defer().await?;
let ephemeral =
ctx.guild_data().await.map_or(false, |gr| gr.map_or(false, |g| g.ephemeral_confirmations));
if ephemeral {
ctx.defer_ephemeral().await?;
} else {
ctx.defer().await?;
}
let user_data = ctx.author_data().await.unwrap();
let timezone = timezone.unwrap_or(ctx.timezone().await);
@ -692,9 +698,10 @@ async fn create_reminder(
},
)
} else {
ctx.say(
"`repeat` is only available to Patreon subscribers or self-hosted users",
)
ctx.send(|b| {
b.content(
"`repeat` is only available to Patreon subscribers or self-hosted users")
})
.await?;
return Ok(());
@ -704,13 +711,18 @@ async fn create_reminder(
};
if processed_interval.is_none() && interval.is_some() {
ctx.say(
"Repeat interval could not be processed. Try similar to `1 hour` or `4 days`",
)
ctx.send(|b| {
b.content(
"Repeat interval could not be processed. Try similar to `1 hour` or `4 days`")
})
.await?;
} else if processed_expires.is_none() && expires.is_some() {
ctx.say("Expiry time failed to process. Please make it as clear as possible")
.await?;
ctx.send(|b| {
b.ephemeral(true).content(
"Expiry time failed to process. Please make it as clear as possible",
)
})
.await?;
} else {
let mut builder = MultiReminderBuilder::new(&ctx, ctx.guild_id())
.author(user_data)