Revert multiline changes
This commit is contained in:
parent
94bfd39085
commit
2a8117d0c1
@ -37,20 +37,6 @@ WHERE
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn multiline_autocomplete(
|
|
||||||
_ctx: Context<'_>,
|
|
||||||
partial: &str,
|
|
||||||
) -> Vec<AutocompleteChoice<String>> {
|
|
||||||
if partial.is_empty() {
|
|
||||||
vec![AutocompleteChoice { name: "Multiline content...".to_string(), value: "".to_string() }]
|
|
||||||
} else {
|
|
||||||
vec![
|
|
||||||
AutocompleteChoice { name: partial.to_string(), value: partial.to_string() },
|
|
||||||
AutocompleteChoice { name: "Multiline content...".to_string(), value: "".to_string() },
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn time_hint_autocomplete(
|
pub async fn time_hint_autocomplete(
|
||||||
ctx: Context<'_>,
|
ctx: Context<'_>,
|
||||||
partial: &str,
|
partial: &str,
|
||||||
|
@ -15,9 +15,7 @@ use poise::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
commands::autocomplete::{
|
commands::autocomplete::{time_hint_autocomplete, timezone_autocomplete},
|
||||||
multiline_autocomplete, time_hint_autocomplete, timezone_autocomplete,
|
|
||||||
},
|
|
||||||
component_models::{
|
component_models::{
|
||||||
pager::{DelPager, LookPager, Pager},
|
pager::{DelPager, LookPager, Pager},
|
||||||
ComponentDataModel, DelSelector, UndoReminder,
|
ComponentDataModel, DelSelector, UndoReminder,
|
||||||
@ -562,20 +560,17 @@ struct ContentModal {
|
|||||||
content: String,
|
content: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a reminder. Press "+4 more" for other options.
|
/// Create a reminder with multi-line content. Press "+4 more" for other options.
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
identifying_name = "remind",
|
identifying_name = "multiline",
|
||||||
default_member_permissions = "MANAGE_GUILD"
|
default_member_permissions = "MANAGE_GUILD"
|
||||||
)]
|
)]
|
||||||
pub async fn remind(
|
pub async fn multiline(
|
||||||
ctx: ApplicationContext<'_>,
|
ctx: ApplicationContext<'_>,
|
||||||
#[description = "A description of the time to set the reminder for"]
|
#[description = "A description of the time to set the reminder for"]
|
||||||
#[autocomplete = "time_hint_autocomplete"]
|
#[autocomplete = "time_hint_autocomplete"]
|
||||||
time: String,
|
time: String,
|
||||||
#[description = "The message content to send"]
|
|
||||||
#[autocomplete = "multiline_autocomplete"]
|
|
||||||
content: String,
|
|
||||||
#[description = "Channel or user mentions to set the reminder for"] channels: Option<String>,
|
#[description = "Channel or user mentions to set the reminder for"] channels: Option<String>,
|
||||||
#[description = "(Patreon only) Time to wait before repeating the reminder. Leave blank for one-shot reminder"]
|
#[description = "(Patreon only) Time to wait before repeating the reminder. Leave blank for one-shot reminder"]
|
||||||
interval: Option<String>,
|
interval: Option<String>,
|
||||||
@ -588,8 +583,6 @@ pub async fn remind(
|
|||||||
timezone: Option<String>,
|
timezone: Option<String>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let tz = timezone.map(|t| t.parse::<Tz>().ok()).flatten();
|
let tz = timezone.map(|t| t.parse::<Tz>().ok()).flatten();
|
||||||
|
|
||||||
if content.is_empty() {
|
|
||||||
let data = ContentModal::execute(ctx).await?;
|
let data = ContentModal::execute(ctx).await?;
|
||||||
|
|
||||||
create_reminder(
|
create_reminder(
|
||||||
@ -603,19 +596,35 @@ pub async fn remind(
|
|||||||
tz,
|
tz,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
} else {
|
|
||||||
create_reminder(
|
|
||||||
Context::Application(ctx),
|
|
||||||
time,
|
|
||||||
content,
|
|
||||||
channels,
|
|
||||||
interval,
|
|
||||||
expires,
|
|
||||||
tts,
|
|
||||||
tz,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a reminder. Press "+4 more" for other options. Use "/multiline" for multiline content.
|
||||||
|
#[poise::command(
|
||||||
|
slash_command,
|
||||||
|
identifying_name = "remind",
|
||||||
|
default_member_permissions = "MANAGE_GUILD"
|
||||||
|
)]
|
||||||
|
pub async fn remind(
|
||||||
|
ctx: ApplicationContext<'_>,
|
||||||
|
#[description = "A description of the time to set the reminder for"]
|
||||||
|
#[autocomplete = "time_hint_autocomplete"]
|
||||||
|
time: String,
|
||||||
|
#[description = "The message content to send"] content: String,
|
||||||
|
#[description = "Channel or user mentions to set the reminder for"] channels: Option<String>,
|
||||||
|
#[description = "(Patreon only) Time to wait before repeating the reminder. Leave blank for one-shot reminder"]
|
||||||
|
interval: Option<String>,
|
||||||
|
#[description = "(Patreon only) For repeating reminders, the time at which the reminder will stop repeating"]
|
||||||
|
expires: Option<String>,
|
||||||
|
#[description = "Set the TTS flag on the reminder message, similar to the /tts command"]
|
||||||
|
tts: Option<bool>,
|
||||||
|
#[description = "Set a timezone override for this reminder only"]
|
||||||
|
#[autocomplete = "timezone_autocomplete"]
|
||||||
|
timezone: Option<String>,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let tz = timezone.map(|t| t.parse::<Tz>().ok()).flatten();
|
||||||
|
|
||||||
|
create_reminder(Context::Application(ctx), time, content, channels, interval, expires, tts, tz)
|
||||||
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn create_reminder(
|
async fn create_reminder(
|
||||||
|
@ -133,6 +133,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
|
|||||||
],
|
],
|
||||||
..reminder_cmds::timer_base()
|
..reminder_cmds::timer_base()
|
||||||
},
|
},
|
||||||
|
reminder_cmds::multiline(),
|
||||||
reminder_cmds::remind(),
|
reminder_cmds::remind(),
|
||||||
poise::Command {
|
poise::Command {
|
||||||
subcommands: vec![
|
subcommands: vec![
|
||||||
|
Loading…
Reference in New Issue
Block a user