how can the bot survive being killed?

Help
2004-04-27
2013-04-09
  • Nobody/Anonymous

    is there any way of handling being killed? i can restart the script after disconnecting, but there will be also need for changinga nickname... how can i handle this?

     
  • Anonymous - 2010-08-29

    What I did was, I registered a !quit function in my bot code, and created a class called keepAlive

    class keepAlive{
    public $isAlive = true;
    }

    $ka = new keepAlive();

    $bot = new myIrcBot($ka);

    while($ka->isAlive){
          //SMART IRC BOT CODE GOES HERE. Make sure to put it all here, except for the defines and the includes. So:

          $irc = new Net_SmartIRC();
          //Etc
    }

     
  • Anonymous - 2010-08-29

    Forgot to add that in my irc bot class I have:
    public function __construct($keepAlive){
          $this->ka = $keepAlive;
    }
    public function quit(&$irc, &$data){
        if($data->messageex == 'mypassword'){
             $this->ka->isAlive = false;
             $irc->quit('OMG MY BOT DIED!');
        }
    }

     

Log in to post a comment.