Menu

Auto-Rejoin + Custom CTCP

Help
Anonymous
2003-08-11
2003-08-13
  • Anonymous

    Anonymous - 2003-08-11

    Heya,

    I am having some problems getting my bot to auto-rejoin a channel if it is kicked.

    Anyone help me out?

    Also, this is an interesting one...

    I would like my bot to send a custom ctcp to people who join the channel.

    I would like the bot to do a /ctcp $nick PASSWORD request where $nick is the person who just joined

    If the user is a registered user they will probably have an irc event hook like this (this is for mirc):

    CTCP *:PASSWORD:CTCPREPLY $NICK PASSWORD some_md5_pw

    (which I hope is self explanatory, but it basically returns some_md5_pw as the ctcpreply to the bot)

    I then need the bot to be able to parse the ctcpreply so it can check it against the user db and automatically auth the user and set the access levels (or not as the case may be).

    I have no idea where to start on this, so any help is appreciated.

    Alexander Hanff

     
    • Anonymous

      Anonymous - 2003-08-12

      autorejoin is easy. I have an include that is run through every time someone gets kicked. If the kicked's name is your bots name, it joins the channel it got kicked out of

      // my code, modified in a more general form //

      if (strpos($data->rawmessage, $yourbotsnick." :")) {
          if ($behavior["autorejoinDelay"] < 0) $behavior["autorejoinDelay"] = 0;
          sleep($behavior["autorejoinDelay"]);
          $irc->join($data->channel);
      }

      // end code //

      ctcp isn't implemented in 0.5.5 yet, afaik.

       
      • Mirco Bauer

        Mirco Bauer - 2003-08-13

        CTCP is implemented but not documentated, you can use for actionhandlers the type SMARTIRC_TYPE_CTCP_REQUEST or SMARTIRC_TYPE_CTCP_REPLY

         
    • Mirco Bauer

      Mirco Bauer - 2003-08-13

      eerr of course also for $irc->message() those types I wrote above works...

       
    • Mirco Bauer

      Mirco Bauer - 2003-08-13

      also about the autrejoin, at the moment you have to handle it yourself with an actionhandler for type kick, like  hpaul did it... but in some cases this doesn't work, like if the channel has a key, you can't grab the key in the actionhandler because in that time the channel is already destroyed in the memory... for this reason I will write for 0.6.0 or 0.7.0 not sure yet, and autorejoin builtin feature. Then $irc->setAutoRejoin(true); $irc->setAutoRejoinDelay(5); would do it :)

       

Log in to post a comment.