Menu

Actionhandlers for ERR Constants?

Help
2003-08-12
2003-08-13
  • Nobody/Anonymous

    This is just an example but for a lot of things i want the bot to be able to respond to errors.

    I want to the bot to try and op itself through Chanserv if the channel it gets told that it cannot send to th channel.  For Actionhandlers i have:

    $irc->registerActionhandler(SMARTIRC_ERR_CANNOTSENDTOCHAN,".*",$geek,"Moderated");

    Which tells the bot to run the moderated function.

    When i used that action handler it would run the moderated function for every error it picks up, which though gets the job done eventualy isn't exactly great programming :)

    So i thought maybe it should be:

    $irc->registerActionhandler(SMARTIRC_TYPE_ERROR,SMARTIRC_ERR_CANNOTSENDTOCHAN,$geek,"Moderated");

    But it doesn't respond to that.  That makes sense though to me...

    Does anyone know a way to setup an Actionhandler for any of the SMARTIRC_ERR_*" constants as defined in defines.php?

    Peter

     
    • Mirco Bauer

      Mirco Bauer - 2003-08-13

      those SMARTIRC_ERR_* are used for SmartIRC internaly, you can only use SMARTIRC_TYPE_* for actionhandlers and $irc->message() (like the documenated says it ;) )...
      But you can write an messagehandler which is IRC message protocol based, just put a method in messagehandler.php and call it even_err_yourerroryouwant

      but use $this instead of $irc

       
    • Anonymous

      Anonymous - 2003-08-13

      Thanks very much, i guess the best way to do it is to edit messaghander.php, most of the functions i'll reuse anyway for possible future bots,

      Thanks for your help,

      Peter

       

Log in to post a comment.