コード例 #1
0
ファイル: sn.php プロジェクト: cmn32480/exec-irc-bot
     if ($account == $verifier_account) {
         pm($verifier_nick, $verifier_msg);
     } else {
         # DON'T TRUST EXEC TO ALERT ANYTHING ON IT'S OWN
         #pm("#soylent",chr(3)."08".chr(2)."*** ALERT: \"".strtoupper($host)."\" HOST IS UNAVAILABLE ON PORT $port ***");
     }
     return;
 }
 $extra_headers = array();
 $extra_headers["Cookie"] = sn_login();
 $response = wget($host, $uri, $port, ICEWEASEL_UA, $extra_headers);
 $delim1 = "<b>Progress So Far: \$";
 $delim2 = "</b>";
 $amount = extract_text($response, $delim1, $delim2);
 if ($amount !== False) {
     $data = exec_file_read("previous_sn_funding");
     $previous = "";
     if (count($data) > 0) {
         $previous = trim($data[0]);
     } else {
         term_echo("funding: count(data) = 0");
     }
     if ($previous != $amount) {
         pm("#soylent", chr(3) . "05" . "*** SN funding has changed from \${$previous} to \${$amount}");
         exec_file_write("previous_sn_funding", array($amount));
     } else {
         term_echo("funding: previous = amount ({$amount})");
     }
 } else {
     term_echo("funding: amount not found in http response");
 }
コード例 #2
0
ファイル: github_feed.php プロジェクト: cmn32480/exec-irc-bot
    $headers["Accept"] = "application/vnd.github.v3+json";
    $params = array();
    $params["title"] = $title;
    $params["body"] = $body . "\n\nsubmitted by exec on behalf of {$nick} from {$dest} @ irc.sylnt.us";
    $json = json_encode($params, JSON_PRETTY_PRINT);
    $response = wpost($host, $uri, $port, ICEWEASEL_UA, $json, $headers, 60, True, False);
    $content = strip_headers($response);
    $data = json_decode($content, True);
    if (isset($data["html_url"]) == True) {
        privmsg($data["html_url"]);
    } else {
        privmsg("there was an error submitting the issue");
    }
    return;
}
$list = exec_file_read("github_feed_repos");
sort($list, SORT_STRING);
if ($alias == "~epoch-feed") {
    $list = array("Subsentient/epoch");
    define("FEED_CHAN", "#epoch");
} else {
    define("FEED_CHAN", "#github");
}
sort($list, SORT_STRING + SORT_FLAG_CASE);
define("CREATE_TIME_FORMAT", "Y-m-d H:i:s ");
if ($alias == "~github-list") {
    $gh_users = array();
    for ($i = 0; $i < count($list); $i++) {
        $a = explode("/", $list[$i]);
        $gh_username = $a[0];
        $gh_repo = $a[1];