Move all commands to their own files
This commit is contained in:
15
src/commands/settings/ephemeral_confirmations/mod.rs
Normal file
15
src/commands/settings/ephemeral_confirmations/mod.rs
Normal 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(())
|
||||
}
|
@ -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(())
|
||||
}
|
@ -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(())
|
||||
}
|
14
src/commands/settings/mod.rs
Normal file
14
src/commands/settings/mod.rs
Normal 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(())
|
||||
}
|
Reference in New Issue
Block a user