/** * Response for intended actions * * @return bool */ private function responseIntendedAction() { $waiting = $this->storage->get($this->getLeadId(), '_wait'); // We set previous_waiting to back to support $bot->keep() method $this->conversation->set('previous_intended_action', $waiting); if (!empty($waiting)) { $this->storage->set($this->getLeadId(), '_wait', false); // Get Nodes for intended actions. if (is_numeric($waiting)) { $nodes = Node::find($waiting); if (!empty($nodes)) { $nodes = [$nodes]; } } else { $nodes = Node::findByTypeAndPattern('intended', $waiting); } $this->response($nodes); return true; } return false; }
/** * Get Nodes by type and patterns * * @param string $type * @param string $pattern * @return \GigaAI\Storage\Eloquent\Node[] */ public function getNodes($type = '', $pattern = '') { return Node::findByTypeAndPattern($type, $pattern); }