Add option types for top-level commands
This commit is contained in:
+2
-15
@@ -1,22 +1,13 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
models::CtxData, time_parser::natural_parser, utils::Extract, ApplicationContext, Context,
|
||||
Error,
|
||||
};
|
||||
use crate::{models::CtxData, time_parser::natural_parser, utils::Extract, Context, Error};
|
||||
|
||||
#[derive(Serialize, Deserialize, Extract)]
|
||||
pub struct Options {
|
||||
until: Option<String>,
|
||||
}
|
||||
|
||||
impl Extract for Options {
|
||||
fn extract(ctx: ApplicationContext) -> Self {
|
||||
Self { until: extract_arg!(ctx, "until", Option<String>) }
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn pause(ctx: Context<'_>, options: Options) -> Result<(), Error> {
|
||||
let timezone = ctx.timezone().await;
|
||||
|
||||
@@ -73,11 +64,7 @@ pub async fn pause(ctx: Context<'_>, options: Options) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Pause all reminders on the current channel until a certain time or indefinitely
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
identifying_name = "pause",
|
||||
default_member_permissions = "MANAGE_GUILD"
|
||||
)]
|
||||
#[poise::command(slash_command, rename = "pause", default_member_permissions = "MANAGE_GUILD")]
|
||||
pub async fn command(
|
||||
ctx: Context<'_>,
|
||||
#[description = "When to pause until"] until: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user