From 815cb0df3b3e3f9dd2078b00f85754da87b1d55e Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 5 Dec 2023 05:17:49 -0500 Subject: refactor: centralize storage handlers --- src/commands/optional/copypasta.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/commands/optional/copypasta.rs') 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(()); } -- cgit v1.2.3