Longman\TelegramBot\Conversation::cancel PHP Method

cancel() public method

Cancel the current conversation
public cancel ( ) : boolean
return boolean
    public function cancel()
    {
        return $this->updateStatus('cancelled') && $this->clear();
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $text = 'No active conversation!';
     //Cancel current conversation if any
     $conversation = new Conversation($this->getMessage()->getFrom()->getId(), $this->getMessage()->getChat()->getId());
     if ($conversation_command = $conversation->getCommand()) {
         $conversation->cancel();
         $text = 'Conversation "' . $conversation_command . '" cancelled!';
     }
     return $this->hideKeyboard($text);
 }
All Usage Examples Of Longman\TelegramBot\Conversation::cancel