File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
99### Deprecated
1010### Removed
1111### Fixed
12+ - Deprecated system commands are now executed via ` GenericmessageCommand ` .
1213### Security
1314
1415## [ 0.3.0] - 2019-07-30
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+ /**
3+ * This file is part of the PHP Telegram Support Bot.
4+ *
5+ * (c) PHP Telegram Bot Team (https://github.com/php-telegram-bot)
6+ *
7+ * For the full copyright and license information, please view the LICENSE
8+ * file that was distributed with this source code.
9+ */
10+
11+ namespace Longman \TelegramBot \Commands \SystemCommands ;
12+
13+ use Longman \TelegramBot \Commands \SystemCommand ;
14+ use Longman \TelegramBot \Entities \ServerResponse ;
15+ use Longman \TelegramBot \Exception \TelegramException ;
16+ use Longman \TelegramBot \Request ;
17+
18+ /**
19+ * Generic message command
20+ */
21+ class GenericmessageCommand extends SystemCommand
22+ {
23+ /**
24+ * @var string
25+ */
26+ protected $ name = 'genericmessage ' ;
27+
28+ /**
29+ * @var string
30+ */
31+ protected $ description = 'Handle generic message ' ;
32+
33+ /**
34+ * @var string
35+ */
36+ protected $ version = '0.1.0 ' ;
37+
38+ /**
39+ * Execute command
40+ *
41+ * @return ServerResponse
42+ * @throws TelegramException
43+ */
44+ public function execute (): ServerResponse
45+ {
46+ // Handle new chat members.
47+ if ($ this ->getMessage ()->getNewChatMembers ()) {
48+ return $ this ->getTelegram ()->executeCommand ('newchatmembers ' );
49+ }
50+
51+ return Request::emptyResponse ();
52+ }
53+ }
You can’t perform that action at this time.
0 commit comments