22 lines
874 B
PHP
22 lines
874 B
PHP
<?php
|
|
require_once __DIR__ . '/../config/config.php';
|
|
require_once __DIR__ . '/../services/BotService.php';
|
|
$db = Database::getInstance();
|
|
$phone = '573010000010';
|
|
// ensure user
|
|
$user = $db->fetch('SELECT * FROM users WHERE phone_number = ?', [$phone]);
|
|
if (!$user) {
|
|
$id = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
|
$user = $db->fetch('SELECT * FROM users WHERE id = ?', [$id]);
|
|
}
|
|
$bot = new BotService();
|
|
|
|
echo "User id: {$user['id']} phone: {$phone}\n";
|
|
|
|
// Simulate sending 'INFORMACION ENVIADA' (uppercase + phrase)
|
|
echo "--- Sending 'INFORMACION ENVIADA' ---\n";
|
|
$bot->processMessage($user, 'INFORMACION ENVIADA', 'text');
|
|
// show last conversation entries
|
|
$rows = $db->fetchAll('SELECT * FROM conversations WHERE user_id = ? ORDER BY created_at DESC LIMIT 5', [$user['id']]);
|
|
print_r($rows);
|