Add option types for top-level commands

This commit is contained in:
jude
2024-02-18 11:04:43 +00:00
parent c1305cfb36
commit 5e39e16060
22 changed files with 395 additions and 268 deletions

View File

@ -1,10 +1,16 @@
use poise::{serenity_prelude::CreateEmbed, CreateReply};
use serde::{Deserialize, Serialize};
use crate::{consts::THEME_COLOR, utils::footer, Context, Error};
use crate::{
consts::THEME_COLOR,
utils::{footer, Extract},
Context, Error,
};
/// Details on supporting the bot and Patreon benefits
#[poise::command(slash_command)]
pub async fn donate(ctx: Context<'_>) -> Result<(), Error> {
#[derive(Serialize, Deserialize, Extract)]
pub struct Options;
pub async fn donate(ctx: Context<'_>, _options: Options) -> Result<(), Error> {
let footer = footer(ctx);
ctx.send(CreateReply::default().embed(CreateEmbed::new().title("Donate")
@ -32,3 +38,9 @@ Just $2 USD/month!
Ok(())
}
/// Details on supporting the bot and Patreon benefits
#[poise::command(slash_command, rename = "patreon")]
pub async fn command(ctx: Context<'_>) -> Result<(), Error> {
donate(ctx, Options {}).await
}