diff --git a/.idea/php.xml b/.idea/php.xml
index 61cd929..8e40365 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -14,6 +14,7 @@
+
diff --git a/project.json b/project.json
index 535d01d..017f573 100644
--- a/project.json
+++ b/project.json
@@ -16,6 +16,14 @@
"build": {
"source_path": "src",
"default_configuration": "release",
+ "dependencies": [
+ {
+ "name": "net.nosial.loglib",
+ "version": "latest",
+ "source_type": "remote",
+ "source": "nosial/libs.log=latest@n64"
+ }
+ ],
"configurations": [
{
"name": "release",
diff --git a/src/TgBotLib/Abstracts/EventType.php b/src/TgBotLib/Abstracts/EventType.php
index c8c4a39..d32bda9 100644
--- a/src/TgBotLib/Abstracts/EventType.php
+++ b/src/TgBotLib/Abstracts/EventType.php
@@ -21,6 +21,23 @@
const ChatPhotoChanged = 'chat_photo_changed';
Const CallbackQuery = 'callback_query';
-
+ const All = [
+ self::GenericUpdate,
+ self::Message,
+ self::EditedMessage,
+ self::GenericCommandMessage,
+ self::ChatMemberJoined,
+ self::ChatMemberLeft,
+ self::ChatMemberKicked,
+ self::ChatMemberBanned,
+ self::ChatMemberUnbanned,
+ self::ChatMemberPromoted,
+ self::ChatMemberDemoted,
+ self::ChatMemberRestricted,
+ self::ChatMemberUnrestricted,
+ self::ChatTitleChanged,
+ self::ChatPhotoChanged,
+ self::CallbackQuery,
+ ];
}
\ No newline at end of file
diff --git a/tests/autoload.php b/tests/autoload.php
new file mode 100644
index 0000000..1fbe9fb
--- /dev/null
+++ b/tests/autoload.php
@@ -0,0 +1,10 @@
+
+ $data = str_replace('/hash ', '', $update->getMessage()->getText());
+ $bot->sendMessage(
+ $update->getMessage()->getChat()->getId(), md5($data)
+ );
+ }
+ }
\ No newline at end of file
diff --git a/tests/get_updates.php b/tests/get_updates.php
deleted file mode 100644
index 19db89c..0000000
--- a/tests/get_updates.php
+++ /dev/null
@@ -1,14 +0,0 @@
-setCommandHandler('start', new \commands\StartCommand());
-
- print_r(json_encode($bot->getMe()->toArray()) . PHP_EOL);
- $bot->sendMessage(570787098, 'Hello, world!');
- $bot->handleGetUpdates();
- unset($bot);
\ No newline at end of file
diff --git a/tests/multi_threaded.php b/tests/multi_threaded.php
new file mode 100644
index 0000000..0338e9b
--- /dev/null
+++ b/tests/multi_threaded.php
@@ -0,0 +1,19 @@
+getUpdates() as $update)
+ {
+ TamerLib\Tamer::do(TamerLib\Objects\Task::create('handle_update', json_encode($update->toArray())));
+ }
+ }
\ No newline at end of file
diff --git a/tests/single_threaded.php b/tests/single_threaded.php
new file mode 100644
index 0000000..e016c40
--- /dev/null
+++ b/tests/single_threaded.php
@@ -0,0 +1,10 @@
+setCommandHandler('start', new \commands\StartCommand());
+ $bot->setCommandHandler('hash', new \commands\HashCommand());
+
+ $bot->handleGetUpdates(true);
\ No newline at end of file
diff --git a/tests/worker.php b/tests/worker.php
new file mode 100644
index 0000000..b9a3421
--- /dev/null
+++ b/tests/worker.php
@@ -0,0 +1,18 @@
+setCommandHandler('start', new \commands\StartCommand());
+ $bot->setCommandHandler('hash', new \commands\HashCommand());
+
+ TamerLib\Tamer::initWorker();
+
+ TamerLib\Tamer::addFunction('handle_update', function (\TamerLib\Objects\Job $job) use ($bot)
+ {
+ $bot->handleUpdate(\TgBotLib\Objects\Telegram\Update::fromArray(json_decode($job->getData(), true)));
+ });
+
+ TamerLib\Tamer::work();
\ No newline at end of file