Longman\TelegramBot\Conversation::exists PHP Method

exists() public method

Check if the conversation already exists
public exists ( ) : boolean
return boolean
    public function exists()
    {
        return $this->conversation !== null;
    }

Usage Example

 /**
  * Execute command
  *
  * @return \Longman\TelegramBot\Entities\ServerResponse
  * @throws \Longman\TelegramBot\Exception\TelegramException
  */
 public function execute()
 {
     //If a conversation is busy, execute the conversation command after handling the message
     $conversation = new Conversation($this->getMessage()->getFrom()->getId(), $this->getMessage()->getChat()->getId());
     //Fetch conversation command if it exists and execute it
     if ($conversation->exists() && ($command = $conversation->getCommand())) {
         return $this->telegram->executeCommand($command);
     }
     return Request::emptyResponse();
 }
All Usage Examples Of Longman\TelegramBot\Conversation::exists