((О|о)тправь|(О|о)тправить)
|
(смс|эсэмэс|SMS|sms)
|
(В|в|ф)сем (.+)
Code
include_once(DIR_MODULES . 'sms_ru/sms_ru.class.php');
$notify = new sms_ru();
$notify->sendNotifyAll($matches[2]);
|
(Роману|Роман|Роме|роману|роме) (.+)
Code
include_once(DIR_MODULES . 'sms_ru/sms_ru.class.php');
$notify = new sms_ru();
$notify->sendNotifByName("Roman phone",$matches[2]);
|
|
|
(включи|поставь|переключи)
|
(радио|на станцию)
|
(рок хиты|рокхиты|хиты рока)
Code
getURL('http://localhost/popup/app_101ru.html?&ajax=1&op=playstation&id=66',0);
|
(энержи|энерджи|Energy|energy)
Code
getURL('http://localhost/popup/app_101ru.html?&ajax=1&op=playstation&id=179',0);
|
|
|
(Д|д)авай приготовим (.+)
Code
$queryString = $matches[2];
/* $findParams = array(
'aerogrill' => '22', // Рецепты для аэрогриля
'waffle' => '27', // Для вафельницы
'yoghurt' => '28', // Для йогуртиницы
'multivarka' => '25', //Рецепты для мультиварки
'steamer' => '15', //Для пароварки
'pressureCooker' => '46', //Для скороварки
'breadMaker' => '23', //Для хлебопечки
'fondue' => '24' //Рецепты фондю
);
*/
$findParams = array();
$recipeNumber = rand(0, 5);
$recipesList = findRecipes($queryString, $findParams);
if (!empty($recipesList)) {
$recipe = getRecipes($recipesList[$recipeNumber]['link']);
$recipe['link'] = $recipesList[$recipeNumber]['link'];
$recipe['name'] = $recipesList[$recipeNumber]['text'];
sayRecipe($recipe);
} else {
say('Ничего не найдено.',2);
}
function sayRecipe($recipe) {
say($recipe['name'],2);
if (!empty($recipe['description'])) {
foreach ($recipe['description'] as $e) {
say($e,2);
}
}
$ingrstr = 'Нам понадобится: ';
foreach ($recipe['ingredients'] as $e) {
$ingrstr .= $e . ', ';
}
say($ingrstr,2);
say('Способ приготовления:');
foreach ($recipe['preparing'] as $e) {
say($e,2);
//registerError('my_debug', urlencode($e));
}
}
function getRecipes($recipeLink) {
if (empty($recipeLink)) {
return FALSE;
}
$html = @file_get_contents($recipeLink);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$xpath = new DOMXpath($doc);
$ingredients = array();
$description = array();
$ingredientsDom = $xpath->query('//table[@class="rec-ingred-table"]/tr');
if ($ingredientsDom->length > 0) {
foreach ($ingredientsDom as $item) {
$ingredients[] = trim(preg_replace("/[\r\n]+/", " ", $item->nodeValue));
}
$descriptionDom = $xpath->query('//div[@class="b-page_block__outside"]/p');
foreach ($descriptionDom as $item) {
$description[] = trim(preg_replace("/[\r\n]+/", " ", $item->nodeValue));
}
} else {
$ingredientsDom = $xpath->query('//div[@class="b-page_block__outside"]/p');
foreach ($ingredientsDom as $item) {
$ingredients[] = trim(preg_replace("/[\r\n]+/", " ", $item->nodeValue));
}
}
$preparingDom = $xpath->query('//div[@class="b-list__clause__text"]/p');
$preparing = array();
foreach ($preparingDom as $item) {
$preparing[] = trim(preg_replace("/[\r\n]+/", " ", $item->nodeValue));
}
$recipe = array(
'description' => $description,
'ingredients' => $ingredients,
'preparing' => $preparing
);
return $recipe;
}
function findRecipes($queryString, $params) {
if (empty($queryString)) {
return FALSE;
}
$url = 'http://www.edimdoma.ru/search?utf8=%E2%9C%93&asset=recipes&index=title_search&query=' . urlencode($queryString) . '&search%5Bmain_category_id%5D=&search%5Bcuisine_id%5D=';
if (!empty($params)) {
foreach ($params as &$value) {
$url .= '&cooking_method_ids%5B%5D=' . $value;
}
}
$url .= '&user_name=';
$html = @file_get_contents($url);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$xpath = new DOMXpath($doc);
$articles = $xpath->query('//div[@class="b-page_block__header"]');
$links = array();
foreach ($articles as $container) {
$arr = $container->getElementsByTagName("a");
foreach ($arr as $item) {
if ($item->parentNode->tagName == "h2") {
$href = $item->getAttribute("href");
$text = trim(preg_replace("/[\r\n]+/", " ", $item->nodeValue));
$links[] = array(
'link' => $href,
'text' => $text
);
}
}
}
return $links;
}
|
(дж|ж)арвис
Code
say ('Я на месте.',2);
say ('Чем могу помочь.', 2);
|
(Н|н)айди фильм (.+)
Code
runScript('kinopoisk', array('kino'=>$matches[2]));
|
(Н|н)овости
|
локомотив
Code
$xml = simplexml_load_file("http://www.championat.com/xml/rss_tag_3.xml");
$i = 0;
foreach ($xml->channel->item as $item) {
if ($item->category == "news")
{
$i= $i+1;
if ($i <= 5) {
$news=$item->title;
say(' '.$news.' ',2);
}
else{
}
}
}
|
спорта
Code
$xml = simplexml_load_file("http://www.vesti.ru/vesti.rss");
$i = 0;
foreach ($xml->channel->item as $item) {
if ($item->category == "Спорт")
{
$i= $i+1;
if ($i <= 5) {
$news=$item->description;
say(' '.$news.' ',2);
}
else{
}
}
}
|
хайтек
Code
$xml = simplexml_load_file("http://www.vesti.ru/vesti.rss");
$i = 0;
foreach ($xml->channel->item as $item) {
if ($item->category == "Hi-Tech. Интернет")
{
$i= $i+1;
if ($i <= 5) {
$news=$item->description;
say(' '.$news.' ',2);
}
else{
}
}
}
|
|
(окей гугл|окей google|ok google)
Code
|
(П|п)огода
|
на завтра
Code
$temp1 = round(getGlobal('ow_day1.temp_morn'));
$temp2 = round(getGlobal('ow_day1.temp_day'));
$temp3 = round(getGlobal('ow_day1.eve'));
$temp4 = round(getGlobal('ow_day1.night'));
$temp5 = round(getGlobal('ow_day1.wind_speed'),1);
$temp6 = getGlobal('ow_day1.weather_type');
say ('Завтра ожидается '.$temp1.' градусов Цельсия',2);
say (' '.$temp6,2);
say ('Ветер '.$temp5.' метра в секунду',2);
|
|
(Р|р)асскажи
|
анекдот
Code
$xml = simplexml_load_file("http://www.anekdot.ru/rss/export_j.xml");
$i = rand (0,9);
$path = $xml->channel->item[$i];
$anek=$path->description;
$anek_say=str_replace(" ", "", $anek);
say(' '.$anek_say.' ',2);
|
про интернет
Code
|
|
(сколько времени|который час)
Code
|
(Ч|ч)то (сейчас|идет) в (кино|кинотеатре)
Code
say("Сейчас в прокате.",2);
$url="http://api.kinopoisk.cf/getTodayFilms";
$data = json_decode(file_get_contents($url), true);
for ($i = 0; $i < count($data['filmsData']); $i++) {
$rating=$data['filmsData'][$i]['rating'];
if ($rating[0]>="6.5"){
$ratio = substr($data['filmsData'][$i]['rating'], 0,4);
say('Фильм '.$data['filmsData'][$i]['nameRU'].'. Жанр '.$data['filmsData'][$i]['genre'].'. Производство '.$data['filmsData'][$i]['country'].' Рейтинг '.$ratio.' ', 2);
}
}
|
выключи
|
радио
Code
getURL('http://localhost/rc/?command=vlc_close', 0);
|
|
Кто ты
Code
say ('Я Джарвис. Просто Довольно Очень Умный Планировщик',2);
|
курс валют
|
на завтра
Code
$ex3=getGlobal('cbr.USD_Tom');
$ex4=getGlobal('cbr.Euro_tom');
say ('Курс доллара на завтра '.$ex3.' рублей', 2);
say ('Курс евро на завтра '.$ex4.' рублей', 2);
|
на сегодня
Code
$ex1=getGlobal('cbr.USD');
$ex2=getGlobal('cbr.Euro');
say ('Курс доллара '.$ex1.' рублей', 2);
say ('Курс евро '.$ex2.' рублей', 2);
|
|
повтори последнее сообщение
Code
$message = getGlobal('ThisComputer.lastSayMessage');
say($message.'. ', 2);
|
посылк(и|а)
Code
getURL('http://localhost/modules/app_postoffice/check_post.php',0);
$track_raw = SQLExec("SELECT pt.track_name, pi.oper_name
FROM db_terminal.post_track pt
JOIN db_terminal.post_trackinfo pi ON ( pt.track_id = pi.track_id )
where pi.oper_date = (select oper_date from db_terminal.post_trackinfo pi2
where pi2.track_id = pt.track_id order by oper_date desc limit 0,1)
ORDER BY pi.oper_date DESC ");
while ($row = mysql_fetch_array($track_raw))
{
say ('Посылка '.$row['track_name'],2);
say ('Местоназначение '.$row['oper_name'], 2);
}
|
статус
|
сценарий (.+)
Code
say("Запускаю сценарий ".$matches[1]);
runScript($matches[1]);
|