diff --git a/api/get_recent_messages.php b/api/get_recent_messages.php index 414a850..8dca369 100644 --- a/api/get_recent_messages.php +++ b/api/get_recent_messages.php @@ -27,7 +27,7 @@ try { u.name FROM conversations c JOIN users u ON c.user_id = u.id - WHERE c.content IS NOT NULL AND c.content != '' + WHERE c.content IS NOT NULL AND c.content != '' AND (c.canal IS NULL OR c.canal = 'bot') ORDER BY c.created_at DESC LIMIT 10" ); diff --git a/api/get_user_messages.php b/api/get_user_messages.php index 3733041..87c9231 100644 --- a/api/get_user_messages.php +++ b/api/get_user_messages.php @@ -74,9 +74,9 @@ try { c.reply_to_message_id as reply_to_message_id, c.reaction_emoji as reaction_emoji, c.reaction_to_message_id as reaction_to_message_id - FROM conversations c + FROM conversations c LEFT JOIN users u ON c.user_id = u.id - WHERE c.user_id = :user_id"; + WHERE c.user_id = :user_id AND (c.canal IS NULL OR c.canal = 'bot')"; // Soporte para paginación estable: before (timestamp) y before_id (id del mensaje más antiguo del bloque) $beforeId = isset($_GET['before_id']) ? intval($_GET['before_id']) : null; @@ -157,8 +157,8 @@ try { mime_type, status, created_at - FROM conversations - WHERE user_id = :user_id + FROM conversations + WHERE user_id = :user_id AND (canal IS NULL OR canal = 'bot') ORDER BY created_at ASC", ['user_id' => $userId] );