當前位置: 首頁>>代碼示例>>PHP>>正文


PHP privmsg函數代碼示例

本文整理匯總了PHP中privmsg函數的典型用法代碼示例。如果您正苦於以下問題:PHP privmsg函數的具體用法?PHP privmsg怎麽用?PHP privmsg使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了privmsg函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_header_login

function get_header_login($host, $uri, $port, $header, $url)
{
    $extra_headers = array();
    $extra_headers["Cookie"] = sn_login();
    $response = whead($host, $uri, $port, ICEWEASEL_UA, $extra_headers);
    sn_logout();
    $header_value = exec_get_header($response, $header, False);
    if ($header_value != "") {
        privmsg("  {$header} header for {$url} = {$header_value}");
    }
}
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:11,代碼來源:header.php

示例2: set_location_alias

function set_location_alias($alias, $trailing)
{
    $parts = explode(" ", $trailing);
    if (count($parts) > 1) {
        $name = $parts[0];
        array_shift($parts);
        $location = implode(" ", $parts);
        if (set_location($name, $location) == False) {
            privmsg("error setting name \"{$name}\" for location \"{$location}\"");
        } else {
            privmsg("name \"{$name}\" set for location \"{$location}\"");
        }
    } else {
        privmsg("syntax: {$alias} name location (name cannot contain spaces but location can contain spaces)");
    }
}
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:16,代碼來源:weather_lib.php

示例3: show_welcome

function show_welcome($nick)
{
    $location = get_location($nick);
    if ($location === False) {
        return;
    }
    $time = get_time($location);
    if ($time == "") {
        return;
    }
    $arr = convert_google_location_time($time);
    $data = process_weather($location, $nick, True);
    if ($data === False) {
        return;
    }
    if ($data["tempC"] === False or $data["tempF"] === False) {
        return;
    }
    privmsg("welcome {$nick}: " . trim($arr["location"]) . ", " . $data["tempC"] . "/" . $data["tempF"] . ", " . date("g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . ", " . date("l, j F Y", $arr["timestamp"]));
}
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:20,代碼來源:welcome.php

示例4: get_help

function get_help($cmd)
{
    $title = "IRC:exec aliases";
    $section = $cmd;
    if (login(True) == False) {
        return False;
    }
    $result = "";
    $text = get_text($title, $section, True, True);
    if ($text !== False) {
        for ($i = 0; $i < min(count($text), 3); $i++) {
            bot_ignore_next();
            privmsg(trim($text[$i]));
        }
        if ($cmd[0] == "~") {
            $cmd = ".7E" . substr($cmd, 1);
        }
        privmsg("http://wiki.soylentnews.org/wiki/IRC:exec_aliases#{$cmd}");
        $result = True;
    }
    logout(True);
    return $result;
}
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:23,代碼來源:help.php

示例5: privmsg

<?php

#####################################################################################################
/*
#exec:~butt|10|0|0|1|@||||php scripts/000.php
*/
#####################################################################################################
require_once "lib.php";
privmsg(get_bucket("process_template_nick"));
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:10,代碼來源:000.php

示例6: array

}
$adverbs = array("brazenly", "spontaneously", "prematurely", "unjustifiably", "insatiably", "abnormally", "abrasively", "accidentally", "allegedly", "clumsily", "cohesively", "covertly", "dexterously", "diabolically", "fanatically", "suspiciously");
$actions = array("cracks open" => "for", "passes" => "to", "throws" => "at", "slides" => "to", "hurls" => "at", "poops" => "for", "drops" => "on", "blows" => "at", "pours" => "for", "flings" => "at", "offers" => "to", "tosses" => "to", "postulates" => "towards");
$containers = array("a cold can", "a used franger", "a pair of used panties full", "a cheap plastic cup", "a wine flute", "a bathtub", "a spoon", "a socket", "a caravan", "a buzz saw", "a blagoblag", "a DD cup", "a tinfoil hat", "an assfull", "a bucket", "a wad", "an anvil", "a toilet bowl", "a coffee++ mug");
$beverages = array("beer", "g'day juice", "coffee", "NCommander", "milo", "boogers", "bewb", "red cordial", "splodge", "skittles", "vibrating rooster sammich", "glowballs", "spew", "pancakes", "\$insert_beverage_here", "toilet water", "ciri poo", "bacon", "dag", "Debian", "coffee++", "Soylent Green");
$last_adverb = get_bucket("<<GDAY_LAST_ADVERB>>");
$last_action = get_bucket("<<GDAY_LAST_ACTION>>");
$last_container = get_bucket("<<GDAY_LAST_CONTAINER>>");
$last_beverage = get_bucket("<<GDAY_LAST_BEVERAGE>>");
$action_keys = array_keys($actions);
do {
    $adverb = $adverbs[rand(0, count($adverbs) - 1)];
} while ($adverb == $last_adverb);
do {
    $action1 = $action_keys[rand(0, count($action_keys) - 1)];
} while ($action1 == $last_action);
do {
    $container = $containers[rand(0, count($containers) - 1)];
} while ($container == $last_container);
do {
    $beverage = $beverages[rand(0, count($beverages) - 1)];
} while ($beverage == $last_beverage);
$action2 = $actions[$action1];
set_bucket("<<GDAY_LAST_ADVERB>>", $adverb);
set_bucket("<<GDAY_LAST_ACTION>>", $action1);
set_bucket("<<GDAY_LAST_CONTAINER>>", $container);
set_bucket("<<GDAY_LAST_BEVERAGE>>", $beverage);
$parts = explode(" ", $trailing);
$target = $parts[0];
privmsg(chr(1) . "ACTION {$adverb} {$action1} {$container} of {$beverage} {$action2} {$target}" . chr(1));
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:31,代碼來源:gday.php

示例7: round

            if ($delta_h != "") {
                $delta_h = $delta_h . ", ";
            }
            if ($delta_m > 1) {
                $delta_m = "{$delta_m} minutes";
            } else {
                $delta_m = "{$delta_m} minute";
            }
        } else {
            $delta_m = "";
        }
        $delta_s = round($delta - $delta_m * 60, 0);
        if ($delta_s > 0) {
            if ($delta_m != "") {
                $delta_m = $delta_m . ", ";
            }
            if ($delta_s > 1) {
                $delta_s = "{$delta_s} seconds";
            } else {
                $delta_s = "{$delta_s} second";
            }
        } else {
            $delta_s = "";
        }
        if (strlen($records[0]["trailing"]) > 300) {
            $records[0]["trailing"] = trim(substr($records[0]["trailing"], 0, 300)) . "...";
        }
        privmsg(chr(3) . $items["nick"] . ", {$trailing} was last seen in " . $items["destination"] . " {$delta_d}{$delta_h}{$delta_m}{$delta_s} ago with message: " . $records[0]["trailing"]);
    }
}
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:31,代碼來源:seen.php

示例8: wget

$host = "www.just-one-liners.com";
$port = 80;
if (mt_rand(0, 4) == 0) {
    $uri = "/";
} else {
    $uri = "/category/confucius-say-wordplay";
}
$response = wget($host, $uri, $port, $agent);
$delim1 = "<h2 class=\"title\" id=\"post-";
$delim2 = "</h2>";
$text = extract_text($response, $delim1, $delim2);
if ($text === False) {
    return;
}
$i = strpos($text, "<");
if ($i === False) {
    return;
}
$text = substr($text, $i);
$text = replace_ctrl_chars($text, " ");
$text = trim(strip_tags($text));
$text = str_replace("  ", " ", $text);
$text = html_decode($text);
$text = html_decode($text);
$text_len = strlen($text);
$max_text_length = 300;
if (strlen($text) > $max_text_length) {
    $text = trim(substr($text, 0, $max_text_length)) . "...";
}
privmsg($text);
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:31,代碼來源:confucius.php

示例9: term_echo

            }
        }
        if ($result != "") {
            term_echo($result);
            $result = strip_tags($result);
            $result = replace_ctrl_chars($result, " ");
            $result = str_replace("  ", " ", $result);
            if (strlen($result) > $max_len) {
                $result = trim(substr($result, 0, $max_len)) . "...";
            }
        } else {
            require_once "wiki_lib.php";
            $title = "Issues to Be Raised at the Next Board Meeting";
            $section = "Next meeting";
            $result = get_text($title, $section, True);
            var_dump($result);
            if (is_array($result) == True) {
                $result = trim(implode(" ", $text));
            }
            if ($result == "") {
                return;
            }
        }
        if (strlen($result) > 200) {
            $result = trim(substr($result, 0, 200)) . "...";
        }
        privmsg(chr(3) . "03" . "********** " . chr(3) . "05" . chr(2) . "SOYLENTNEWS BOARD MEETING" . chr(2) . chr(3) . "03" . " **********");
        privmsg(chr(3) . "03" . trim($result));
        break;
}
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:31,代碼來源:staff.php

示例10: ini_set

<?php

#####################################################################################################
/*
exec:~say|10|0|0|1|crutchy,chromas||||php scripts/say.php %%trailing%% %%nick%%
*/
#####################################################################################################
ini_set("display_errors", "on");
require_once "lib.php";
$trailing = $argv[1];
$parts = explode(" ", $trailing);
$dest = substr(strtolower($parts[0]), 1, strlen($parts[0]) - 2);
$ischan = False;
$isnick = False;
$delim1 = substr($parts[0], 0, 1);
$delim2 = substr($parts[0], strlen($parts[0]) - 1);
if ($delim1 == "<" and $delim2 == ">") {
    $ischan = users_chan_exists($dest);
    $isnick = users_nick_exists($dest);
}
if ($ischan == True or $isnick == True) {
    array_shift($parts);
    $trailing = implode(" ", $parts);
    pm($dest, $trailing);
    pm("crutchy", $trailing);
} else {
    privmsg($trailing);
}
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:29,代碼來源:say.php

示例11: explode

<?php

#####################################################################################################
/*
exec:~invite|5|0|0|0|||||php scripts/join.php %%trailing%%
exec:~join|5|0|0|0|||||php scripts/join.php %%trailing%%
*/
#####################################################################################################
require_once "lib.php";
$parts = explode(",", $argv[1]);
$prefixes = "#&";
for ($i = 0; $i < count($parts); $i++) {
    $parts[$i] = trim($parts[$i]);
    if (strpos($prefixes, substr($parts[$i], 0, 1)) === False) {
        return;
    }
}
$chans = trim(implode(",", $parts));
if ($chans != "") {
    echo "/IRC JOIN {$chans}\n";
} else {
    privmsg("syntax: ~join <channel>[,<channel>[,<channel>]]");
}
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:24,代碼來源:join.php

示例12: trim

<?php

#####################################################################################################
/*
exec:~wget|20|0|0|1|||||php scripts/wget.php %%trailing%%
*/
#####################################################################################################
require_once "lib.php";
require_once "wget_lib.php";
$trailing = trim($argv[1]);
term_echo("wget: {$trailing}");
if ($trailing == "") {
    privmsg("syntax: ~wget url delim 1 <> delim 2");
    return;
}
$result = quick_wget($trailing);
if ($result == False) {
    privmsg("syntax: ~wget url delim 1 <> delim 2");
    return;
}
if (strlen($result) > 300) {
    $result = trim(substr($result, 0, 300)) . "...";
}
privmsg(chr(3) . "07" . $result);
#####################################################################################################
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:25,代碼來源:wget.php

示例13: explode

$parts = explode(" ", $trailing);
if (count($parts) < 2) {
    return;
}
$valid_data_cmd = get_valid_data_cmd(False);
$cmd = strtolower($parts[0]);
array_shift($parts);
$trailing = trim(implode(" ", $parts));
$bot_nick = $parts[0];
array_shift($parts);
$trailing = trim(implode(" ", $parts));
$forward = False;
switch ($cmd) {
    case "new":
        if (users_nick_exists($bot_nick, $dest) == True) {
            privmsg("{$bot_nick} is already here");
            return;
        }
        #$socket=fsockopen("ssl://irc.sylnt.us","6697");
        if (count($parts) == 3) {
            $server = $parts[0];
            $port = $parts[1];
        } else {
            $server = "irc.sylnt.us";
            $port = "6667";
        }
        $socket = fsockopen($server, $port);
        if ($socket === False) {
            term_echo("ERROR CREATING IRC SOCKET");
            return;
        }
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:31,代碼來源:minion.php

示例14: comment_test

function comment_test()
{
    global $passed;
    $subject = "test subject";
    $comment_body = "test comment body";
    $sid = "15/04/17/1849229";
    # sd-key-sid
    $parent_cid = "";
    if (sn_comment($subject, $comment_body, $sid, $parent_cid) === False) {
        privmsg("comment test failed (1)");
        $passed = False;
    }
}
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:13,代碼來源:slash_test.php

示例15: source_define

function source_define($host, $term, $params)
{
    global $debug;
    $sterm = $term;
    if ($params["space_delim"] != "") {
        $sterm = str_replace(" ", $params["space_delim"], $sterm);
    }
    $uri = str_replace($params["template"], urlencode($sterm), $params["uri"]);
    term_echo("*** DEFINE: trying {$host}{$uri} on port " . $params["port"]);
    $response = wget($host, $uri, $params["port"], ICEWEASEL_UA, "", 20);
    $html = strip_headers($response);
    $html = replace_ctrl_chars($html, " ");
    strip_all_tag($html, "head");
    strip_all_tag($html, "script");
    if ($debug == "ON") {
        privmsg("debug [{$host}]: uri = \"{$uri}\"");
        $L = strlen($html);
        privmsg("debug [{$host}]: html length = \"{$L}\"");
        unset($L);
        privmsg("debug [{$host}]: delim_start = \"" . $params["delim_start"] . "\"");
        privmsg("debug [{$host}]: delim_end = " . $params["delim_end"] . "\"");
    }
    $i = strpos($html, $params["delim_start"]);
    $def = "";
    if ($i !== False) {
        if ($debug == "ON") {
            privmsg("debug [{$host}]: delim_start pos = \"{$i}\"");
        }
        $html = substr($html, $i + strlen($params["delim_start"]));
        $i = strpos($html, $params["delim_end"]);
        if ($i !== False) {
            if ($debug == "ON") {
                privmsg("debug [{$host}]: delim_end pos = \"{$i}\"");
            }
            $def = trim(strip_tags(substr($html, 0, $i)));
            $def = str_replace(array("\n", "\r"), " ", $def);
            $def = str_replace("  ", " ", $def);
            if (strlen($def) > MAX_DEF_LENGTH) {
                $def = trim(substr($def, 0, MAX_DEF_LENGTH)) . "...";
            }
        }
    }
    if ($def == "") {
        $location = exec_get_header($response, "location");
        if ($location == "") {
            return False;
        } else {
            $new_term = extract_text($location, $params["get_param"], "&", True);
            if ($new_term != $term) {
                term_echo("redirecting to \"{$location}\"");
                if ($debug == "ON") {
                    privmsg("debug [{$host}]: redirecting to \"{$location}\"");
                }
                return source_define($host, $new_term, $params);
            } else {
                return False;
            }
        }
    } else {
        if ($params["ignore"] != "" and strpos($def, $params["ignore"]) !== False) {
            return False;
        }
        if (strpos($def, "There aren't any definitions") !== False) {
            return False;
        }
        privmsg("[" . $params["name"] . "] " . chr(3) . "03{$term}" . chr(3) . ": " . html_decode($def));
        return True;
    }
}
開發者ID:cmn32480,項目名稱:exec-irc-bot,代碼行數:69,代碼來源:definitions.php


注:本文中的privmsg函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。