Update emojis and improve regex
This commit is contained in:
parent
3b03facde9
commit
3be2145536
|
@ -163,7 +163,7 @@ function telegramBotRouter() {
|
|||
$message->reply("Disponibilità aggiorata con successo.\nOra sei <b>operativo</b>.");
|
||||
});
|
||||
|
||||
$Bot->onText("/\/?(Io |Io sono )?(Disattiva|Disattivami|Non( |_)attivo|Non( |_)(Sono |sono )?disponibile|Non( |_)(Sono |sono )?operativo|disattiva|sisattivami|non( |_)(Sono |sono )?attivo|non( |_)(Sono |sono )?disponibile|non( |_)(Sono |sono )?operativo)/", function (Message $message, $matches = []) {
|
||||
$Bot->onText("/\/?(Io |Io sono )?(Disattiva|Disattivo|Disattivami|Non( |_)attivo|Non( |_)(Sono |sono )?disponibile|Non( |_)(Sono |sono )?operativo|disattiva|sisattivami|non( |_)(Sono |sono )?attivo|non( |_)(Sono |sono )?disponibile|non( |_)(Sono |sono )?operativo)/", function (Message $message, $matches = []) {
|
||||
global $availability;
|
||||
requireBotLogin($message);
|
||||
if(count(explode(" ", $message->text)) > 4) return;
|
||||
|
@ -184,9 +184,7 @@ function telegramBotRouter() {
|
|||
$msg .= "\n<b>".$user["name"]."</b>";
|
||||
if($user["driver"]) $msg .= " 🚒";
|
||||
if($user["chief"]) {
|
||||
$msg .= " 🟥";
|
||||
} else {
|
||||
$msg .= " ⬛";
|
||||
$msg .= " CS";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -262,20 +262,22 @@ class Availability {
|
|||
{
|
||||
logger("Disponibilità cambiata in ".($availability ? '"disponibile"' : '"non disponibile"'), $user_id, $this->users->auth->getUserId());
|
||||
|
||||
$available_users_count = $this->db->selectValue("SELECT COUNT(id) FROM `".DB_PREFIX."_profiles` WHERE `available` = 1 AND `hidden` = 0");
|
||||
if($available_users_count >= 5) {
|
||||
sendTelegramNotification("✅ Distaccamento operativo con squadra completa");
|
||||
} else if($available_users_count >= 2) {
|
||||
sendTelegramNotification("🚒 Distaccamento operativo per supporto");
|
||||
} else {
|
||||
sendTelegramNotification("⚠️ Distaccamento non operativo");
|
||||
}
|
||||
|
||||
return $this->db->update(
|
||||
$response = $this->db->update(
|
||||
DB_PREFIX."_profiles",
|
||||
["available" => $availability, 'availability_last_change' => 'manual'],
|
||||
["id" => $user_id]
|
||||
);
|
||||
|
||||
$available_users_count = $this->db->selectValue("SELECT COUNT(id) FROM `".DB_PREFIX."_profiles` WHERE `available` = 1 AND `hidden` = 0");
|
||||
if($available_users_count >= 5) {
|
||||
sendTelegramNotification("✅ Distaccamento operativo con squadra completa");
|
||||
} else if($available_users_count >= 2) {
|
||||
sendTelegramNotification("🧯 Distaccamento operativo per supporto");
|
||||
} else {
|
||||
sendTelegramNotification("⚠️ Distaccamento non operativo");
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue