generated from mirzaev/pot
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
8ea9e7ef3d | |||
05143b6865 | |||
accfe5a496 |
@@ -184,6 +184,8 @@ final class interneturok extends core
|
|||||||
// Waiting for processing the request
|
// Waiting for processing the request
|
||||||
sleep($waiting);
|
sleep($waiting);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
if ($this->authentication($account)->wait()) {
|
if ($this->authentication($account)->wait()) {
|
||||||
// Authenticated the account
|
// Authenticated the account
|
||||||
|
|
||||||
@@ -233,7 +235,7 @@ final class interneturok extends core
|
|||||||
// Found the target subject
|
// Found the target subject
|
||||||
|
|
||||||
// Writing into the output buffer
|
// Writing into the output buffer
|
||||||
echo "Найден школьный предмет: $subject->value для $grade класса (с " . new datetime($event->date)->format('d.m') . ' по ' . new datetime($event->date)->modify('+6 days')->format('d.m') . ")\n";
|
/* echo "Найден школьный предмет: $subject->value для $grade класса (с " . new datetime($event->date)->format('d.m') . ' по ' . new datetime($event->date)->modify('+6 days')->format('d.m') . ")\n"; */
|
||||||
|
|
||||||
// Initializing the unblock time
|
// Initializing the unblock time
|
||||||
$unblock = svoboda::timestamp() - 31536000;
|
$unblock = svoboda::timestamp() - 31536000;
|
||||||
@@ -318,6 +320,9 @@ final class interneturok extends core
|
|||||||
// Proceed to processing the next account
|
// Proceed to processing the next account
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
} catch (exception $exception) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -900,6 +905,7 @@ final class interneturok extends core
|
|||||||
*/
|
*/
|
||||||
public static function amount(): int
|
public static function amount(): int
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
// Opening the interneturok accounts file
|
// Opening the interneturok accounts file
|
||||||
$file = new spl(INTERNETUROK_ACCOUNTS_FILE, 'r');
|
$file = new spl(INTERNETUROK_ACCOUNTS_FILE, 'r');
|
||||||
|
|
||||||
@@ -911,5 +917,9 @@ final class interneturok extends core
|
|||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
return $rows;
|
return $rows;
|
||||||
|
} catch (exception $exception) {
|
||||||
|
// Exit (fail)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,9 @@ use Zanzara\Context as context,
|
|||||||
// Framework for asynchronous PHP
|
// Framework for asynchronous PHP
|
||||||
use function React\Async\await;
|
use function React\Async\await;
|
||||||
|
|
||||||
|
// Built-in libraries
|
||||||
|
use Exception as exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Telegram shcool subjects parser
|
* Telegram shcool subjects parser
|
||||||
*
|
*
|
||||||
@@ -205,6 +208,7 @@ final class parser extends core
|
|||||||
// Initializing the parser
|
// Initializing the parser
|
||||||
$parser = new interneturok();
|
$parser = new interneturok();
|
||||||
|
|
||||||
|
try {
|
||||||
// Parsing homework files
|
// Parsing homework files
|
||||||
$files = $parser->parse(subject: $subject, grade: $grade, waiting: 3);
|
$files = $parser->parse(subject: $subject, grade: $grade, waiting: 3);
|
||||||
|
|
||||||
@@ -224,7 +228,17 @@ final class parser extends core
|
|||||||
// Not initialized homework files
|
// Not initialized homework files
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('❌ *Не найдены домашние задания')
|
$context->sendMessage('❌ *Не найдены домашние задания*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the menu with subjects
|
||||||
|
commands::menu($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (exception $exception) {
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Произошла ошибка при обработке домашних заданий*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user