diff options
| author | seth <[email protected]> | 2023-12-05 05:17:49 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-12-15 16:41:13 -0500 |
| commit | 815cb0df3b3e3f9dd2078b00f85754da87b1d55e (patch) | |
| tree | 85099483f8ebb0586bc097b65f6c5a2b5997150e /src/commands/optional | |
| parent | 0ca61ddff6ec7404f0aeabc1c8c785bbc8db7fd5 (diff) | |
refactor: centralize storage handlers
Diffstat (limited to 'src/commands/optional')
| -rw-r--r-- | src/commands/optional/copypasta.rs | 8 | ||||
| -rw-r--r-- | src/commands/optional/teawiespam.rs | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/commands/optional/copypasta.rs b/src/commands/optional/copypasta.rs index ea23f5f..289a936 100644 --- a/src/commands/optional/copypasta.rs +++ b/src/commands/optional/copypasta.rs @@ -1,4 +1,4 @@ -use crate::{Context, Settings}; +use crate::Context; use std::collections::HashMap; @@ -66,11 +66,13 @@ pub async fn copypasta( ctx: Context<'_>, #[description = "the copypasta you want to send"] copypasta: Copypastas, ) -> Result<()> { + debug!("Running copypasta command with copypasta {copypasta}"); + let gid = ctx.guild_id().unwrap_or_default(); - let settings = Settings::from_redis(&ctx.data().redis, &gid).await?; + let settings = ctx.data().storage.get_guild_settings(&gid).await?; if !settings.optional_commands_enabled { - debug!("Not running copypasta command in {gid} since it's disabled"); + debug!("Exited copypasta command in {gid} since it's disabled"); return Ok(()); } diff --git a/src/commands/optional/teawiespam.rs b/src/commands/optional/teawiespam.rs index c1b3b29..bb8f32d 100644 --- a/src/commands/optional/teawiespam.rs +++ b/src/commands/optional/teawiespam.rs @@ -1,4 +1,4 @@ -use crate::{Context, Settings}; +use crate::Context; use color_eyre::eyre::Result; use log::*; @@ -6,8 +6,10 @@ use log::*; /// teawie will spam you. #[poise::command(slash_command, prefix_command)] pub async fn teawiespam(ctx: Context<'_>) -> Result<()> { + debug!("Running teawiespam command"); + let gid = ctx.guild_id().unwrap_or_default(); - let settings = Settings::from_redis(&ctx.data().redis, &gid).await?; + let settings = ctx.data().storage.get_guild_settings(&gid).await?; if !settings.optional_commands_enabled { debug!("Not running teawiespam in {gid} since it's disabled"); |
