All pastes #381946 Raw Edit

M3IRC

public text v1 · immutable
·published 2007-03-05 04:52 UTC
rendered paste body
<?php

 class M3IRC {
  
  $conn = 0;

  function connect($server,$nick,$user,$real) {
   $conn = fsockopen($server,6667);
   fwrite($conn, "NICK $nick");
   fwrite($conn, "USER $user :$real");
  }
  
  function join($chan) {
   fwrite($conn, "JOIN $chan");
  }

  function talk($target,$msg) {
   fwrite($conn, "PRIVMSG $target :$msg");
  }
  
  function mode($chan,$mode,$args,$useargs) {
   if($useargs == 1) 
    { fwrite($conn, "MODE $chan $mode $args"); }
    else
    { fwrite($conn, "MODE $chan $mode"); }
  }
  
  function quit($msg) {
   fwrite($conn, "QUIT :$msg");
  }
 
 } //!M3IRC

// implementation:

$irc = new M3IRC();
$irc->connect("127.0.0.1","WoDAdmin","AdminBoT","WoD Administrative RoBot");
$irc->join("#wodgame");
$irc->talk("#wodgame","Hello, all! im a bot!");
sleep(2000);
$irc->quit("Bye");

?>