Longman\TelegramBot\Commands\UserCommands\DateCommand::execute PHP Method

execute() public method

Command execute method
public execute ( ) : mixed
return mixed
    public function execute()
    {
        //First we set up the necessary member variables.
        $this->client = new Client(['base_uri' => $this->google_api_base_uri]);
        if (($this->google_api_key = trim($this->getConfig('google_api_key'))) === '') {
            $this->google_api_key = null;
        }
        $message = $this->getMessage();
        $chat_id = $message->getChat()->getId();
        $location = $message->getText(true);
        $text = 'You must specify location in format: /date <city>';
        if ($location !== '') {
            $text = $this->getFormattedDate($location);
        }
        $data = ['chat_id' => $chat_id, 'text' => $text];
        return Request::sendMessage($data);
    }