@@ -10,33 +10,33 @@ |
||
10 | 10 | class UpdateReceiver implements UpdateReceiverInterface |
11 | 11 | { |
12 | 12 | |
13 | - private $config; |
|
14 | - private $telegramBotApi; |
|
15 | - |
|
16 | - public function __construct(TelegramBotApi $telegramBotApi, $config) |
|
17 | - { |
|
18 | - $this->telegramBotApi = $telegramBotApi; |
|
19 | - $this->config = $config; |
|
20 | - } |
|
21 | - |
|
22 | - public function handleUpdate(Update $update) |
|
23 | - { |
|
24 | - $message = json_decode(json_encode($update->message), true); |
|
25 | - |
|
26 | - switch ($message['text']) { |
|
27 | - case "/about": |
|
28 | - case "/about@{$this->config['bot_name']}": |
|
29 | - $text = "I'm a Buktopuha Telegram Bot"; |
|
30 | - break; |
|
31 | - case "/help": |
|
32 | - case "/help@{$this->config['bot_name']}": |
|
33 | - default : |
|
34 | - $text = "Command List:\n"; |
|
35 | - $text .= "/about - About this bot\n"; |
|
36 | - $text .= "/help - show this help message\n"; |
|
37 | - break; |
|
38 | - } |
|
39 | - |
|
40 | - $this->telegramBotApi->sendMessage($message['chat']['id'], $text); |
|
41 | - } |
|
13 | + private $config; |
|
14 | + private $telegramBotApi; |
|
15 | + |
|
16 | + public function __construct(TelegramBotApi $telegramBotApi, $config) |
|
17 | + { |
|
18 | + $this->telegramBotApi = $telegramBotApi; |
|
19 | + $this->config = $config; |
|
20 | + } |
|
21 | + |
|
22 | + public function handleUpdate(Update $update) |
|
23 | + { |
|
24 | + $message = json_decode(json_encode($update->message), true); |
|
25 | + |
|
26 | + switch ($message['text']) { |
|
27 | + case "/about": |
|
28 | + case "/about@{$this->config['bot_name']}": |
|
29 | + $text = "I'm a Buktopuha Telegram Bot"; |
|
30 | + break; |
|
31 | + case "/help": |
|
32 | + case "/help@{$this->config['bot_name']}": |
|
33 | + default : |
|
34 | + $text = "Command List:\n"; |
|
35 | + $text .= "/about - About this bot\n"; |
|
36 | + $text .= "/help - show this help message\n"; |
|
37 | + break; |
|
38 | + } |
|
39 | + |
|
40 | + $this->telegramBotApi->sendMessage($message['chat']['id'], $text); |
|
41 | + } |
|
42 | 42 | } |