storkit: merge 440_refactor_consolidate_is_permission_approval_into_chat_util
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::chat::transport::matrix::{ConversationEntry, ConversationRole, RoomConversation};
|
||||
use crate::chat::util::is_permission_approval;
|
||||
use crate::http::context::{PermissionDecision};
|
||||
use crate::slog;
|
||||
use super::WhatsAppWebhookContext;
|
||||
use super::format::{chunk_for_whatsapp, markdown_to_whatsapp};
|
||||
use super::history::save_whatsapp_history;
|
||||
|
||||
/// Returns `true` if the message body should be interpreted as permission approval.
|
||||
fn is_permission_approval(body: &str) -> bool {
|
||||
let trimmed = body.trim().to_ascii_lowercase();
|
||||
matches!(
|
||||
trimmed.as_str(),
|
||||
"yes" | "y" | "approve" | "allow" | "ok"
|
||||
)
|
||||
}
|
||||
|
||||
/// Dispatch an incoming WhatsApp message to bot commands.
|
||||
pub(super) async fn handle_incoming_message(ctx: &WhatsAppWebhookContext, sender: &str, message: &str) {
|
||||
use crate::chat::commands::{CommandDispatch, try_handle_command};
|
||||
|
||||
Reference in New Issue
Block a user