Move all commands to their own files

This commit is contained in:
jude
2024-02-17 18:55:16 +00:00
parent eb92eacb90
commit 4823754955
51 changed files with 1757 additions and 1699 deletions

View File

@ -0,0 +1,15 @@
use crate::{Context, Error};
pub mod set_ephemeral_confirmations;
pub mod unset_ephemeral_confirmations;
/// Configure ephemeral setup
#[poise::command(
slash_command,
rename = "ephemeral",
identifying_name = "ephemeral_confirmations",
guild_only = true
)]
pub async fn ephemeral_confirmations(_ctx: Context<'_>) -> Result<(), Error> {
Ok(())
}

View File

@ -0,0 +1,31 @@
use poise::{serenity_prelude::CreateEmbed, CreateReply};
use crate::{consts::THEME_COLOR, models::CtxData, Context, Error};
/// Set reminder confirmations to be sent "ephemerally" (private and cleared automatically)
#[poise::command(
slash_command,
rename = "on",
identifying_name = "set_ephemeral_confirmations",
guild_only = true
)]
pub async fn set_ephemeral_confirmations(ctx: Context<'_>) -> Result<(), Error> {
let mut guild_data = ctx.guild_data().await.unwrap()?;
guild_data.ephemeral_confirmations = true;
guild_data.commit_changes(&ctx.data().database).await;
ctx.send(
CreateReply::default().ephemeral(true).embed(
CreateEmbed::new()
.title("Confirmations ephemeral")
.description(concat!(
"Reminder confirmations will be sent privately, and removed when your client",
" restarts."
))
.color(*THEME_COLOR),
),
)
.await?;
Ok(())
}

View File

@ -0,0 +1,31 @@
use poise::{serenity_prelude::CreateEmbed, CreateReply};
use crate::{consts::THEME_COLOR, models::CtxData, Context, Error};
/// Set reminder confirmations to persist indefinitely
#[poise::command(
slash_command,
rename = "off",
identifying_name = "unset_ephemeral_confirmations",
guild_only = true
)]
pub async fn unset_ephemeral_confirmations(ctx: Context<'_>) -> Result<(), Error> {
let mut guild_data = ctx.guild_data().await.unwrap()?;
guild_data.ephemeral_confirmations = false;
guild_data.commit_changes(&ctx.data().database).await;
ctx.send(
CreateReply::default().ephemeral(true).embed(
CreateEmbed::new()
.title("Confirmations public")
.description(concat!(
"Reminder confirmations will be sent as regular messages, and won't be ",
"removed automatically."
))
.color(*THEME_COLOR),
),
)
.await?;
Ok(())
}

View File

@ -0,0 +1,14 @@
use crate::{Context, Error};
pub mod ephemeral_confirmations;
/// Configure server settings
#[poise::command(
slash_command,
rename = "settings",
identifying_name = "settings",
guild_only = true
)]
pub async fn settings(_ctx: Context<'_>) -> Result<(), Error> {
Ok(())
}