diff --git a/src/commands/fun.rs b/src/commands/fun.rs index 8e770fc..d036def 100644 --- a/src/commands/fun.rs +++ b/src/commands/fun.rs @@ -199,7 +199,8 @@ impl TypeMapKey for AiChatKey { #[poise::command(slash_command, prefix_command, guild_only, owners_only)] pub async fn ai_chat(ctx: Context<'_>) -> Result<(), Error> { - let manager = ctx.data().ai_chat.clone(); + let data = ctx.serenity_context().data.read().await; + let manager = data.get::().cloned().ok_or_else(|| anyhow::anyhow!("AI Chat manager not found"))?; let channel_id = ctx.channel_id(); let enabled = manager.toggle_channel(channel_id).await; diff --git a/src/commands/utility.rs b/src/commands/utility.rs index a10ee7c..ab4beed 100644 --- a/src/commands/utility.rs +++ b/src/commands/utility.rs @@ -237,7 +237,8 @@ pub async fn summary( return Ok(()); }; - let ai_chat_manager = ctx.data().ai_chat.clone(); + let data = ctx.serenity_context().data.read().await; + let ai_chat_manager = data.get::().cloned().ok_or_else(|| anyhow::anyhow!("AI Chat manager not found"))?; let content = msg.content.trim(); if content.is_empty() {