| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | public function execute() |
||
| 43 | { |
||
| 44 | $message = $this->getMessage(); |
||
| 45 | |||
| 46 | //You can use $command as param |
||
| 47 | $chat_id = $message->getChat()->getId(); |
||
| 48 | $user_id = $message->getFrom()->getId(); |
||
| 49 | $command = $message->getCommand(); |
||
| 50 | |||
| 51 | //If the user is and admin and the command is in the format "/whoisXYZ", call the /whois command |
||
| 52 | if (stripos($command, 'whois') === 0 && $this->telegram->isAdmin($user_id)) { |
||
| 53 | return $this->telegram->executeCommand('whois'); |
||
| 54 | } |
||
| 55 | |||
| 56 | $data = [ |
||
| 57 | 'chat_id' => $chat_id, |
||
| 58 | 'text' => 'Command /' . $command . ' not found.. :(', |
||
| 59 | ]; |
||
| 60 | |||
| 61 | return Request::sendMessage($data); |
||
| 62 | } |
||
| 63 | } |
||
| 64 |