Revert multiline changes
This commit is contained in:
		@@ -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,7 +560,45 @@ 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(
 | 
				
			||||||
 | 
					    slash_command,
 | 
				
			||||||
 | 
					    identifying_name = "multiline",
 | 
				
			||||||
 | 
					    default_member_permissions = "MANAGE_GUILD"
 | 
				
			||||||
 | 
					)]
 | 
				
			||||||
 | 
					pub async fn multiline(
 | 
				
			||||||
 | 
					    ctx: ApplicationContext<'_>,
 | 
				
			||||||
 | 
					    #[description = "A description of the time to set the reminder for"]
 | 
				
			||||||
 | 
					    #[autocomplete = "time_hint_autocomplete"]
 | 
				
			||||||
 | 
					    time: 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();
 | 
				
			||||||
 | 
					    let data = ContentModal::execute(ctx).await?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    create_reminder(
 | 
				
			||||||
 | 
					        Context::Application(ctx),
 | 
				
			||||||
 | 
					        time,
 | 
				
			||||||
 | 
					        data.content,
 | 
				
			||||||
 | 
					        channels,
 | 
				
			||||||
 | 
					        interval,
 | 
				
			||||||
 | 
					        expires,
 | 
				
			||||||
 | 
					        tts,
 | 
				
			||||||
 | 
					        tz,
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    .await
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/// Create a reminder. Press "+4 more" for other options. Use "/multiline" for multiline content.
 | 
				
			||||||
#[poise::command(
 | 
					#[poise::command(
 | 
				
			||||||
    slash_command,
 | 
					    slash_command,
 | 
				
			||||||
    identifying_name = "remind",
 | 
					    identifying_name = "remind",
 | 
				
			||||||
@@ -573,9 +609,7 @@ pub async fn remind(
 | 
				
			|||||||
    #[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"]
 | 
					    #[description = "The message content to send"] content: String,
 | 
				
			||||||
    #[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>,
 | 
				
			||||||
@@ -589,33 +623,8 @@ pub async fn remind(
 | 
				
			|||||||
) -> 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() {
 | 
					    create_reminder(Context::Application(ctx), time, content, channels, interval, expires, tts, tz)
 | 
				
			||||||
        let data = ContentModal::execute(ctx).await?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        create_reminder(
 | 
					 | 
				
			||||||
            Context::Application(ctx),
 | 
					 | 
				
			||||||
            time,
 | 
					 | 
				
			||||||
            data.content,
 | 
					 | 
				
			||||||
            channels,
 | 
					 | 
				
			||||||
            interval,
 | 
					 | 
				
			||||||
            expires,
 | 
					 | 
				
			||||||
            tts,
 | 
					 | 
				
			||||||
            tz,
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        .await
 | 
					        .await
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        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![
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user