Auto commit: 2026-02-18T23:47:05.794Z

This commit is contained in:
Flatlogic Bot 2026-02-18 23:47:05 +00:00
parent 4af4672e9d
commit 3e41d10cfc
2 changed files with 22 additions and 1 deletions

View File

@ -55,7 +55,10 @@ if ($method === 'GET') {
$msg['level_color'] = '#94a3b8';
$msg['level_emoji'] = '';
if ($msg['username'] === $topRequester) {
if ($msg['username'] === 'Lili Bot 🤖') {
$msg['level_color'] = '#00e676';
$msg['level_emoji'] = '🤖';
} elseif ($msg['username'] === $topRequester) {
$msg['level_color'] = '#facc15';
$msg['level_emoji'] = '👑';
$msg['is_top_listener'] = true;

View File

@ -229,6 +229,7 @@ if ($action === 'send') {
if (!$stmt->fetch()) {
$rewards = [50, 30, 20];
$rewarded_users = [];
foreach ($top_chatters as $i => $c) {
if ($i >= 3) break;
$username = $c['username'];
@ -243,7 +244,24 @@ if ($action === 'send') {
} else {
$db->prepare("INSERT INTO fans (name, points) VALUES (?, ?)")->execute([$username, $points_to_add]);
}
$rewarded_users[$username] = $points_to_add;
}
// Bot message to chat
if (!empty($rewarded_users)) {
$bot_msg = "🏆 ¡Atención comunidad! El Top 3 de interactores de esta semana ha sido premiado:\n\n";
$medals = ["🥇", "🥈", "🥉"];
$idx = 0;
foreach ($rewarded_users as $user => $pts) {
$bot_msg .= "{$medals[$idx]} $user: +$pts Fan Points\n";
$idx++;
}
$bot_msg .= "\n¡Sigue participando en el chat para ganar el próximo lunes! 📻✨";
$db->prepare("INSERT INTO messages (username, ip_address, message, type) VALUES (?, ?, ?, ?)")
->execute(['Lili Bot 🤖', '127.0.0.1', $bot_msg, 'text']);
}
$db->prepare("INSERT INTO automation_logs (task_name, last_run) VALUES ('weekly_report_rewards', NOW()) ON DUPLICATE KEY UPDATE last_run = NOW()")->execute();
}