Add option types for top-level commands
This commit is contained in:
@ -2,17 +2,11 @@ use log::warn;
|
||||
use poise::CreateReply;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models::CtxData, utils::Extract, ApplicationContext, Context, Error};
|
||||
use crate::{models::CtxData, utils::Extract, Context, Error};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Extract)]
|
||||
pub struct Options;
|
||||
|
||||
impl Extract for Options {
|
||||
fn extract(_ctx: ApplicationContext) -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn webhook(ctx: Context<'_>, _options: Options) -> Result<(), Error> {
|
||||
match ctx.channel_data().await {
|
||||
Ok(data) => {
|
||||
@ -40,11 +34,7 @@ Do not share it!
|
||||
}
|
||||
|
||||
/// View the webhook being used to send reminders to this channel
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
identifying_name = "webhook_url",
|
||||
required_permissions = "ADMINISTRATOR"
|
||||
)]
|
||||
#[poise::command(slash_command, rename = "webhook", required_permissions = "ADMINISTRATOR")]
|
||||
pub async fn command(ctx: Context<'_>) -> Result<(), Error> {
|
||||
webhook(ctx, Options {}).await
|
||||
}
|
||||
|
Reference in New Issue
Block a user