PHP PITC IRC Client Script

By Giygas on Sep 25, 2012

This code is a basic simplistic script designed for 1.0+ versions of the new and unique PITC IRC Client written in pure PHP. It has a fantastic API. Try it out yourselves. Has some humor in it. Don't take my try on the actual product =p. Love PHP.

<?php
/*  BetaBOT (PHP IRC Bot)
    By Giygas
    Designed for PITC IRC CLIENT
    http://pitc.x10.mx
*/

$api->addTextHandler("bot_text");

function bot_text($args) {
    global $_PITC;
    global $api;
    $chan = $args['channel'];
    $message = $args['text'];
    $mess = explode(" ",$args['text']);
    if (strtolower($message) == "no u") {
        $api->msg($chan,"no u");
    }
    if (strtolower($message) == "!rand") {
        $irand = rand(0, 100);
        $api->msg($chan,$irand);
    }
    if (strtolower($mess[0]) == "!shot") {
        if (isset($mess[1])) {
            $api->msg($chan,$_PITC['nick']." pours ".$mess[1]." some chill liquor.");
        }
        else {
            $api->msg($chan,$_PITC['nick']." pours fresh vodka.");
        }
    }
    if (strtolower($message) == "!tits") {
        $api->msg($chan,"IT'S GETTING HOT IN HERE. SO TAKE OFF ALL YOUR CLOTHES");
    }
    if (strtolower($message) == "freddiemercury") {
        $api->msg($chan,"Mama, just killed a man");
        $api->msg($chan,"Put a gun against his head, pulled my triggers now he's dead");
        $api->msg($chan,"Maaamaaa, life had just begun");
        $api->msg($chan,"But now I've gone and thrown it all awaaaay...");
        $api->msg($chan,"Maaamaaaaa, OOOOoOOOOooOOOO");
        $api->msg($chan,"Didn't mean to make you CRY");
        $api->msg($chan,"If I'm not back again this time tomorrow, carry on, carry on...");
        $api->msg($chan,"..as if nothing really matters");
        $api->msg($chan,"Too late, my time has come");
        $api->msg($chan,"Send shivers down my spine, body's aching all the time");
        $api->msg($chan,"Goodbye everybody, I've got to goooo");
        $api->msg($chan,"Gotta leave you all behind AND FACE THE TRUTTHHHH");
        $api->msg($chan,"MAAAAAMAAAAAAAA, ooOOOOooOOOOOOOOO");
        $api->msg($chan,"I DON'T WANNA DIEEEE");
        $api->msg($chan,"I SOMETIMES WISH I'VE NEVER BEEN BORN AT ALLLLLLL");
        $api->msg($chan,"*guitar solo*");
    }
}
?>

Comments

Sign in to comment.
TMFKSOFT   -  Sep 25, 2012

Haha nice script!

You can use

global $_PITC, $api;

There's no need for a seperate line.

PITC can return an array of words instead of a string so

$message = $args['text'];
$mess = explode(" ",$args['text']);

can become

$mess = $args['text_array'];

I love the Freddie Mercury trigger mainly as I LOVE that song and Queen in general.

p.s. I've noticed on line 26 and 29 you're repeating the bot's name, if you want an action you can do

$api->action("slaps someone.");
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.