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

execute() public method

Command execute method
public execute ( ) : ServerResponse
return Longman\TelegramBot\Entities\ServerResponse
    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->removeKeyboard($text);
    }