function handle($msg, $params) { require_once BOT_TOPDIR . '/modules/' . $params[0]; if (!defined('BOT_TYPE')) { define('BOT_TYPE', $msg->userAlt->interface); } $_GET['to'] = $msg->userAlt->bot; $_GET['from'] = $msg->userAlt->uid; try { call_user_func(array($params[1], $params[2]), $msg->command, $msg->args); } catch (BotLegacyEnd $e) { } return GGapi::getResponse(); }
/** * Zwraca pomoc dla określonej parametrem komendy * @param null|string $params Nazwa komendy * @return false|BotMsg Zwracana wiadomość */ function help($params = NULL) { if ($params === NULL) { return $this->cache_help(); } else { $data = $this->register(); if (!$data[$params]) { return FALSE; } foreach ($data[$params] as $module) { $ret = @(include_once BOT_TOPDIR . '/modules/' . $module['params'][0]); if (!$ret) { continue; } call_user_func(array($module['params'][1], 'help'), $params); } $data = GGapi::getResponse(); if ($data instanceof BotMsg) { return $data; } else { return FALSE; } } }