Link all top-level commands with macro recording/replaying logic

This commit is contained in:
jude
2024-02-18 13:24:37 +00:00
parent 5e39e16060
commit 76a286076b
25 changed files with 619 additions and 410 deletions
+18 -16
View File
@@ -3,32 +3,34 @@ use serde::{Deserialize, Serialize};
use crate::{
consts::THEME_COLOR,
utils::{footer, Extract},
utils::{footer, Extract, Recordable},
Context, Error,
};
#[derive(Serialize, Deserialize, Extract)]
pub struct Options;
pub async fn dashboard(ctx: Context<'_>, _options: Options) -> Result<(), Error> {
let footer = footer(ctx);
impl Recordable for Options {
async fn run(self, ctx: Context<'_>) -> Result<(), Error> {
let footer = footer(ctx);
ctx.send(
CreateReply::default().ephemeral(true).embed(
CreateEmbed::new()
.title("Dashboard")
.description("**https://beta.reminder-bot.com/dashboard**")
.footer(footer)
.color(*THEME_COLOR),
),
)
.await?;
ctx.send(
CreateReply::default().ephemeral(true).embed(
CreateEmbed::new()
.title("Dashboard")
.description("**https://beta.reminder-bot.com/dashboard**")
.footer(footer)
.color(*THEME_COLOR),
),
)
.await?;
Ok(())
Ok(())
}
}
/// Get the link to the web dashboard
#[poise::command(slash_command, rename = "dashboard")]
#[poise::command(slash_command, rename = "dashboard", identifying_name = "dashboard")]
pub async fn command(ctx: Context<'_>) -> Result<(), Error> {
dashboard(ctx, Options {}).await
(Options {}).run(ctx).await
}