public static function parse($message) { $obj = new self(); $obj->text(Lou::trans_html($message->text())); $obj->screen_name($message->user()->screen_name()); $obj->profile_image_url($message->user()->profile_image_url()); $obj->created_at($message->created_at()); if ($message instanceof WassrMessage) { $obj->type("wassr"); } else { if ($message instanceof TwitterMessage) { $obj->type("twitter"); } } return $obj; }
$bot->add_privmsg($message, $data['user']); } return true; } else { $bot->add_privmsg("Ne Ne Ne!", $data['user']); } }, 'settlers'); $bot->add_msg_hook(array(PRIVATEIN, ALLYIN), "AddLawless", "LouBot_add_lawless", true, '/(addlawless|addll)/i', function ($bot, $data) { global $redis; if ($bot->is_ally_user($data['user']) && !$bot->is_himself($data['user'])) { $message = "Add lawless:"; if (is_array($data['params'])) { foreach ($data['params'] as $ll) { if (Lou::is_string_pos(Lou::prepare_chat($ll))) { // is position? $pos = Lou::get_pos_by_string(Lou::prepare_chat($ll)); $continent = $bot->lou->get_continent_by_pos($pos); $continent_key = "continent:{$continent}"; if ($redis->sAdd("{$continent_key}:lawless", $pos)) { $message .= " {$pos}|Ok"; $str_time = (string) time(); $city_id = $redis->hGet('cities', $pos); $city_key = "city:{$city_id}"; $city = $redis->hGetALL("{$city_key}:data"); $redis->hMset("{$city_key}:data", array('ll_time' => $str_time, 'll_name' => $city['name'], 'll_state' => $city['state'], 'll_points' => $city['points'], 'll_user_id' => $city['user_id'], 'll_category' => $city['category'], 'll_alliance_id' => $city['alliance_id'])); } else { $message .= " {$pos}|Nok"; } } } } else {
private function prepare_range_reports($data, $folder = 0) { $items = array(); switch ($folder) { case 0: if (is_array($data)) { foreach ($data as $item) { $items[] = array('type' => REPORTHEADER, 'time' => round($item['d'] / 1000, 0), 'id' => $item['i'], 'name' => $item['l'], 'owner' => $item['o'], 'owner_name' => $item['on'], 'opponent' => $item['p'], 'report_origin' => $item['t'], 'report_type' => Lou::prepare_report_type($item['t']), 'report_text' => Lou::prepare_report_text($item['t'], $item['p'], $item['l'])); } } break; } return $items; }
} break; case stripos($data['params'][0], 'k') !== false && in_array(substr($data['params'][0], 1), $continents): if ($bot->is_op_user($data['user'])) { $continent = intval(substr($data['params'][0], 1)); $hours = array(1, 2, 6, 12, 24, 36, 72); $range = in_array(intval($data['params'][1]), $hours) ? intval($data['params'][1]) : 2; $message = "Du bekommst den aktuellen Digest-{$range}h für K{$continent} zugestellt!"; send_digest_3($continent, $data['user'], mktime(date("H") - $range, 0, 0, date("n"), date("j"), date("Y")), $range); break; } else { $message = "Ne Ne Ne!"; } } } else { $bot->add_privmsg('Digest: falsche Parameter (' . Lou::prepare_chat($data['params'][0]) . ')!', $data['user']); } if ($data["channel"] == ALLYIN) { $bot->add_allymsg($data['user'] . ', ' . $message); } else { $bot->add_privmsg($message, $data['user']); } return true; } else { $bot->add_privmsg("Ne Ne Ne!", $data['user']); } }, 'digest'); if (!function_exists('send_digest_3')) { function send_digest_3($continents, $receivers, $start = false, $range = 24) { global $bot, $redis;