Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use serenity::prelude::*;
use std::collections::HashSet;
use std::sync::Arc;
use tokio::sync::watch;
use tracing::{debug, error, info};
use tracing::{debug, error, info, warn};

/// Hard cap on consecutive bot messages (from any other bot) in a
/// channel or thread. When this many recent messages are all from
Expand Down Expand Up @@ -205,6 +205,7 @@ impl EventHandler for Handler {
});

// Process attachments: route by content type (audio β†’ STT, image β†’ encode)
let mut audio_skipped = false;
if !msg.attachments.is_empty() {
for attachment in &msg.attachments {
if is_audio_attachment(attachment) {
Expand All @@ -216,7 +217,8 @@ impl EventHandler for Handler {
});
}
} else {
debug!(filename = %attachment.filename, "skipping audio attachment (STT disabled)");
warn!(filename = %attachment.filename, "skipping audio attachment (STT disabled)");
audio_skipped = true;
}
} else if let Some(content_block) = download_and_encode_image(attachment).await {
debug!(url = %attachment.url, filename = %attachment.filename, "adding image attachment");
Expand All @@ -225,6 +227,15 @@ impl EventHandler for Handler {
}
}

// If audio was skipped, react with 🎀 so the user knows their voice message was noticed
if audio_skipped {
let _ = msg.react(&ctx.http, ReactionType::Unicode("🎀".into())).await;
// Voice-only message: no text and only the sender_context block β†’ early return
if prompt.is_empty() && content_blocks.len() == 1 {
return;
}
}

tracing::debug!(
text_len = prompt_with_sender.len(),
num_attachments = msg.attachments.len(),
Expand Down
Loading