示例#1
0
            $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 {
示例#2
0
                    }
                    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;