potential fix

This commit is contained in:
2025-12-30 13:02:41 +05:30
parent 3076b1da4c
commit 457adaa3ff
2 changed files with 4 additions and 2 deletions

View File

@@ -199,7 +199,8 @@ impl TypeMapKey for AiChatKey {
#[poise::command(slash_command, prefix_command, guild_only, owners_only)] #[poise::command(slash_command, prefix_command, guild_only, owners_only)]
pub async fn ai_chat(ctx: Context<'_>) -> Result<(), Error> { 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::<AiChatKey>().cloned().ok_or_else(|| anyhow::anyhow!("AI Chat manager not found"))?;
let channel_id = ctx.channel_id(); let channel_id = ctx.channel_id();
let enabled = manager.toggle_channel(channel_id).await; let enabled = manager.toggle_channel(channel_id).await;

View File

@@ -237,7 +237,8 @@ pub async fn summary(
return Ok(()); 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::<commands::fun::AiChatKey>().cloned().ok_or_else(|| anyhow::anyhow!("AI Chat manager not found"))?;
let content = msg.content.trim(); let content = msg.content.trim();
if content.is_empty() { if content.is_empty() {