Compare commits

..

5 Commits

12 changed files with 9 additions and 7 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

7
README.md Normal file → Executable file
View File

@@ -1,6 +1,7 @@
# Viber chat-robot # Viber chat-robot
Sending requests from [mirzaev/spetsresurs-google_sheets-parser](https://git.mirzaev.sexy/mirzaev/spetsresurs-google_sheets-parser) to [mirzaev/arangodb](https://git.mirzaev.sexy/mirzaev/arangodb) and vice versa Sending requests from [mirzaev/spetsresurs-google_sheets-parser](https://git.mirzaev.sexy/mirzaev/spetsresurs-google_sheets-parser) to [mirzaev/arangodb](https://git.mirzaev.sexy/mirzaev/arangodb) and vice versa for [mirzaev/ebala](https://git.mirzaev.sexy/mirzaev/ebala)</br>
</br>
~~😼 Developed in 1 day for 100000 rubles ($1200)~~ shit happens ~~😼 Developed in 1 day for 100000 rubles ($1200)~~ shit happens</br>
**DEVELOPMENT COMPLETED. PROJECT CLOSED.**

0
composer.json Normal file → Executable file
View File

0
composer.lock generated Normal file → Executable file
View File

View File

View File

View File

@@ -13,7 +13,6 @@ use ArangoDBClient\Document as _document,
// Фреймворк для Viber API // Фреймворк для Viber API
use Viber\Bot, use Viber\Bot,
Viber\Api\Sender, Viber\Api\Sender,
Viber\Api\Event,
Viber\Api\Keyboard, Viber\Api\Keyboard,
Viber\Api\Keyboard\Button, Viber\Api\Keyboard\Button,
Viber\Api\Message\Contact, Viber\Api\Message\Contact,
@@ -184,7 +183,9 @@ function requests(int $amount = 5, int $page = 1): Cursor
$arangodb->session, $arangodb->session,
[ [
'query' => sprintf( 'query' => sprintf(
"FOR d IN works FILTER d.confirmed != 'да' SORT d.created DESC LIMIT %d, %d RETURN d", "FOR d IN works FILTER d.date >= '%s' && d.date <= '%s' && d.worker == '' && d.confirmed != 'да' SORT d.created DESC LIMIT %d, %d RETURN d",
(new DateTime('now'))->setTime(7, 0)->format('d.m.Y'),
(new DateTime('tomorrow'))->setTime(7, 0)->format('d.m.Y'),
$offset, $offset,
$amount + $offset $amount + $offset
), ),
@@ -284,7 +285,7 @@ try {
$count = $requests->getCount(); $count = $requests->getCount();
// Проверка существования избытка // Проверка существования избытка
$excess = $count === 6; $excess = $count % 6 === 0;
// Обрезка заявок до размера страницы // Обрезка заявок до размера страницы
$requests = array_slice($requests->getAll(), 0, 5); $requests = array_slice($requests->getAll(), 0, 5);
@@ -340,7 +341,7 @@ try {
(new Text()) (new Text())
->setSender($botSender) ->setSender($botSender)
->setReceiver($id) ->setReceiver($id)
->setText("**#{$request->getKey()}**\n\n" . $request->date['converted'] . " (" . $request->start['converted'] . " - " . $request->end['converted'] . ")\n**Работа:** \"$request->work\"\n\n**Город:** $market->city\n**Адрес:** $market->address") ->setText("**#{$request->getKey()}**\n\n" . ($request->date['converted'] ?? $request->date) . " (" . ($request->start['converted'] ?? $request->start) . " - " . ($request->end['converted'] ?? $request->end) . ")\n**Работа:** \"$request->work\"\n\n**Город:** $market->city\n**Адрес:** $market->address")
); );
// Запись выбора заявки в клавиатуру // Запись выбора заявки в клавиатуру

View File