Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
b1f3be28e0 | |||
23ccfcdc93 | |||
31022e24af |
@@ -4,7 +4,7 @@
|
||||
"license": "WTFPL",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"mirzaev\\spetsresurs\\\\telegram\\robot\\entry\\": "mirzaev/spetsresurs/telegram/robot/entry/system/"
|
||||
"mirzaev\\spetsresurs\\telegram\\robot\\entry\\": "mirzaev/spetsresurs/telegram/robot/entry/system/"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
|
@@ -23,7 +23,7 @@ use Google\Client,
|
||||
Google\Service\Sheets\ValueRange;
|
||||
|
||||
|
||||
require __DIR__ . '/../../../../../../vendor/autoload.php';
|
||||
require __DIR__ . '/../../../../../../../vendor/autoload.php';
|
||||
|
||||
/* ini_set('error_reporting', E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
@@ -54,6 +54,7 @@ $bot->onMessage(function (Context $ctx) {
|
||||
|
||||
$timer = React\Promise\Timer\sleep(180);
|
||||
|
||||
// @todo Если сотрудник вышел из чата и снова зашёл, ответил правильно и его оставило, то всё равно забанит из-за прошлой сессии
|
||||
$timer->then(
|
||||
function ($value) use ($ctx, $id) {
|
||||
// Изгнание из чата
|
||||
@@ -79,7 +80,8 @@ function check(Context $ctx)
|
||||
if ($member === $ctx->getMessage()->getFrom()->getId()) {
|
||||
// Отправителем табельного номера является тот кто подключился к серверу
|
||||
|
||||
$id = $ctx->getMessage()->getText();
|
||||
// Инициализация идентификатора (только цифры)
|
||||
$id = preg_replace('/[^\d]/', '', $ctx->getMessage()->getText());
|
||||
|
||||
$settings = json_decode(require(__DIR__ . '/../settings/workers/google.php'), true);
|
||||
$document = require(__DIR__ . '/../settings/workers/document.php');
|
||||
@@ -110,7 +112,7 @@ function check(Context $ctx)
|
||||
}
|
||||
}
|
||||
|
||||
$ctx->sendMessage("⛔ Не найден сотрудник: $id");
|
||||
if (!empty($id)) $ctx->sendMessage("⛔ Не найден сотрудник: $id");
|
||||
}
|
||||
}
|
||||
}
|
17
telegram-robot-entry.service
Executable file
17
telegram-robot-entry.service
Executable file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Telegram-robot-entry
|
||||
|
||||
Wants=network.target
|
||||
After=syslog.target network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=sudo -u www-data /usr/bin/php /var/www/spetsresurs-telegram-robot-entry/mirzaev/spetsresurs/telegram/robot/entry/system/public/robot.php
|
||||
PIDFile=/var/run/php/telegram-robot-entry.pid
|
||||
RemainAfterExit=no
|
||||
RuntimeMaxSec=3600s
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user