Longman\TelegramBot\Commands\SystemCommands\GenericCommand::execute PHP Method

execute() public method

Command execute method
public execute ( ) : mixed
return mixed
    public function execute()
    {
        $message = $this->getMessage();
        //You can use $command as param
        $chat_id = $message->getChat()->getId();
        $user_id = $message->getFrom()->getId();
        $command = $message->getCommand();
        //If the user is and admin and the command is in the format "/whoisXYZ", call the /whois command
        if (stripos($command, 'whois') === 0 && $this->telegram->isAdmin($user_id)) {
            return $this->telegram->executeCommand('whois');
        }
        $data = ['chat_id' => $chat_id, 'text' => 'Command /' . $command . ' not found.. :('];
        return Request::sendMessage($data);
    }
GenericCommand