Код: Выделить всё
$this->sendAction($chat_id, "typing");
$em_l = json_decode('"'.'\ud83d\udca1'.'"');
$em_k = json_decode('"'.'\ud83d\udcac'.'"');
$em_n = json_decode('"'.'\u21a9\ufe0f'.'"');
$em_c = json_decode('"'.'\ud83d\udcf8'.'"');
$em_i = json_decode('"'.'\ud83d\udee0'.'"');
$em_s = json_decode('"'.'\u2699'.'"');
$em_g = json_decode('"'.'\ud83c\udf21'.'"');
$em_p = json_decode('"'.'\ud83c\udf24'.'"');
$em_o = json_decode('"'.'\ud83d\udcdd'.'"');
$off = json_decode('"'.'\ud83c\udf11'.'"');
$on = json_decode('"'.'\ud83c\udf15'.'"');
$em_rd = json_decode('"'.'\ud83d\udc47'.'"');
$em_cam = json_decode('"'.'\ud83c\udfa5'.'"');
$em_kuh = json_decode('"'.'\ud83c\udfa5 \ud83c\udf7d'.'"'); //\ud83c\udf7d
$em_kom = json_decode('"'.'\ud83c\udfa5 \ud83d\udecb'.'"'); //\ud83d\udecb
$pos = strripos($text , "Меню");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
$option = array( array($em_l." Свет", $em_c." Камеры"), array($em_p." Погода", $em_g." Климат"), array($em_o." Отчеты", $em_s." Служебное"));
$this->sendMessageToUser($chat_id, $em_k." Выберите нужный пункт ".$em_rd, $option);
$skip = true;
}
$pos = strripos($text , "Погода");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
$option = array( array($em_l." Свет", $em_c." Камеры"), array($em_p." Погода", $em_g." Климат"), array($em_o." Отчеты", $em_s." Служебное"));
$this->sendMessageToUser($chat_id, gg('Kirov.Metcast'), $option);
$skip = true;
}
$pos = strripos($text , "Климат");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
$option = array( array($em_l." Свет", $em_c." Камеры"), array($em_p." Погода", $em_g." Климат"), array($em_o." Отчеты", $em_s." Служебное"));
$climat = "Температура ".gg('ThisComputer.RoomTemp')." С. Относительная влажность ".gg('ThisComputer.RoomHumidity')." %. Атмосферное давление ".gg('Kirov.Pressure')." мм.рт.ст.";
$this->sendMessageToUser($chat_id, $climat, $option);
$skip = true;
}
$pos = strripos($text , "Свет");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
if (gg("Relay1MegaD1.status") == 1) $ks = $on; else $ks = $off;
if (gg("Relay2MegaD2.status") == 1) $ps = $on; else $ps = $off;
if (gg("Relay1MegaD2.status") == 1) $rs = $on; else $rs = $off;
if (gg("SID701_Ch1.status") == 1) $ds = $on; else $ds = $off;
$option = array( array($ks." Кухня", $ps." Прихожая"), array($rs." Комната", $ds." Подсветка"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_k." Можно включать и выключать свет:", $option);
$skip = true;
}
$pos = strripos($text , "Кухня");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
cm("Relay1MegaD1.switch");
if (gg("Relay1MegaD1.status") == 1) $ks = $on; else $ks = $off;
if (gg("Relay2MegaD2.status") == 1) $ps = $on; else $ps = $off;
if (gg("Relay1MegaD2.status") == 1) $rs = $on; else $rs = $off;
if (gg("SID701_Ch1.status") == 1) $ds = $on; else $ds = $off;
$option = array( array($ks." Кухня", $ps." Прихожая"), array($rs." Комната", $ds." Подсветка"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_k." Можно включать и выключать свет:", $option);
$skip = true;
}
$pos = strripos($text , "Прихожая");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
cm("Relay2MegaD2.switch");
//$this->sendMessageToUser($chat_id, $em_l." Метод света в прихожей");
if (gg("Relay1MegaD1.status") == 1) $ks = $on; else $ks = $off;
if (gg("Relay2MegaD2.status") == 1) $ps = $on; else $ps = $off;
if (gg("Relay1MegaD2.status") == 1) $rs = $on; else $rs = $off;
if (gg("SID701_Ch1.status") == 1) $ds = $on; else $ds = $off;
$option = array( array($ks." Кухня", $ps." Прихожая"), array($rs." Комната", $ds." Подсветка"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_k." Можно включать и выключать свет:", $option);
$skip = true;
}
$pos = strripos($text , "Комната");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
cm("Relay1MegaD2.switch");
//$this->sendMessageToUser($chat_id, $em_l." Метод света в комнате");
if (gg("Relay1MegaD1.status") == 1) $ks = $on; else $ks = $off;
if (gg("Relay2MegaD2.status") == 1) $ps = $on; else $ps = $off;
if (gg("Relay1MegaD2.status") == 1) $rs = $on; else $rs = $off;
if (gg("SID701_Ch1.status") == 1) $ds = $on; else $ds = $off;
$option = array( array($ks." Кухня", $ps." Прихожая"), array($rs." Комната", $ds." Подсветка"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_k." Можно включать и выключать свет:", $option);
$skip = true;
}
$pos = strripos($text , "Подсветка");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
cm("SID701_Ch1.switch");
//$this->sendMessageToUser($chat_id, $em_l." Метод подсветки в шкафу");
if (gg("Relay1MegaD1.status") == 1) $ks = $on; else $ks = $off;
if (gg("Relay2MegaD2.status") == 1) $ps = $on; else $ps = $off;
if (gg("Relay1MegaD2.status") == 1) $rs = $on; else $rs = $off;
if (gg("SID701_Ch1.status") == 1) $ds = $on; else $ds = $off;
$option = array( array($ks." Кухня", $ps." Прихожая"), array($rs." Комната", $ds." Подсветка"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_k." Можно включать и выключать свет:", $option);
$skip = true;
}
$pos = strripos($text , "Камеры");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
$option = array( array($em_kuh." Web-cam 1", $em_kom." Web-cam 2"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_cam." Можно получить фото с камеры видеонаблюдения", $option);
$skip = true;
}
$pos = strripos($text , "Web-cam 1");
if ($pos > -1) {
$this->sendAction($chat_id, "upload_photo");
if ( gg('webcam_1.status') != 1 ) {
if ( gg('minMsgLevel') == 1 ) sg('minMsgLevel', '2');
cm('webcam_1.turnOn');
setTimeOut('startSendPhotoScript', 'runScript("sendPhoto", array("chat_id"=>'.$chat_id.'));', 3);
DebMes('Get Photo from ID ' . $chat_id);
setTimeOut('webCamOff', 'cm("webcam_1.turnOff");if ( gg("minMsgLevel") == 2 ) sg("minMsgLevel", "1");', 10);
} else {
runScript('sendPhoto', array('chat_id'=>$chat_id));
}
$skip = true;
//$option = array( array($em_kuh." Web-cam 1", $em_kom." Web-cam 2"), array("Меню") );
//$this->sendMessageToUser($chat_id, $em_cam." Можно получить фото с камеры видеонаблюдения", $option);
}
$pos = strripos($text , "Web-cam 2");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
$option = array( array($em_kuh." Web-cam 1", $em_kom." Web-cam 2"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_cam." Камера в комнате не работает", $option);
$skip = true;
}
$pos = strripos($text , "Служебное");
if ($pos > -1) {
$this->sendAction($chat_id, "typing");
$option = array( array("IP", "Ping"), array("Меню") );
$this->sendMessageToUser($chat_id, $em_i." Служебные сведения", $option);
$skip = true;
}
//Для того чтобы после обработки кода в событии прекратить дальнейшую обработку команд и шаблонов, надо в коде задать значение переменной $skip=true;
//$skip = true;
/*
// \ud83d\udca1 лампочка
// \ud83d\udcac комментарий
// \u21a9\ufe0f назад
// \ud83d\udcf8 камера
// \ud83d\udee0 инструменты
// \u2699 шестеренка
// \ud83c\udf21 градусник
// \ud83c\udf24 погода
// \ud83d\udcdd отчеты
// \ud83d\udc47 рука вниз
// \ud83c\udf24 камера
// \u041f\u043e\u0433 диван
// \u043e\u0434\u0430 тарелка-ложки
*/