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
+28 -17
View File
@@ -1,19 +1,24 @@
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,
};
/// Get information about the bot
#[poise::command(slash_command)]
pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
#[derive(Serialize, Deserialize, Extract)]
pub struct Options;
pub async fn info(ctx: Context<'_>, _options: Options) -> Result<(), Error> {
let footer = footer(ctx);
let _ = ctx
.send(
CreateReply::default().ephemeral(true).embed(
CreateEmbed::new()
.title("Info")
.description(
"Help: `/help`
ctx.send(
CreateReply::default().ephemeral(true).embed(
CreateEmbed::new()
.title("Info")
.description(
"Help: `/help`
**Welcome to Reminder Bot!**
Developer: <@203532103185465344>
@@ -22,12 +27,18 @@ Find me on https://discord.jellywx.com and on https://github.com/JellyWX :)
Invite the bot: https://invite.reminder-bot.com/
Use our dashboard: https://reminder-bot.com/",
)
.footer(footer)
.color(*THEME_COLOR),
),
)
.await;
)
.footer(footer)
.color(*THEME_COLOR),
),
)
.await?;
Ok(())
}
/// Get information about the bot
#[poise::command(slash_command, rename = "info")]
pub async fn command(ctx: Context<'_>) -> Result<(), Error> {
info(ctx, Options {}).await
}