Menu

bot cannot join channel

Help
2003-12-29
2013-04-09
  • Nobody/Anonymous

    Here is my code.
    -------------ex.php-------------------
    <?
    include('./Net_SmartIRC-0[1].5.5p1/Net_SmartIRC-0.5.5p1/SmartIRC.php');

    $irc = &new Net_SmartIRC();

    class mybot
    {
        function test_command(&$irc, &$data)
        {
            $irc->message(SMARTIRC_TYPE_CHANNEL, '#testchn, $data->nick.': no I don't like tests!');
        }
    }

    $mybot = &new mybot();

    $irc->setUseSockets(true);

    $irc->setDebug(SMARTIRC_DEBUG_ALL);

    $irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '!test', &$mybot, 'test_command');

    $irc->connect('irc.dankun.net', 6667);

    $irc->login('maruta', 'MyBotty Bot', 0,'MyBotty');

    $irc->join('#testchn');

    $irc->listen();

    $irc->disconnect();

    ?>
    ----------------------------

    (include path is correct.)

    And when I open ex.php,

    I get the error message like this.

    ----------------------------
    Parse error: parse error in /home/gilproduction_net/public_html/irc/ex.php on line 10
    ----------------------------

    Line 10 is

            $irc->message(SMARTIRC_TYPE_CHANNEL, '#testchn, $data->nick.': no I don't like tests!');

    What can I do to solve this problem?

     
    • Nobody/Anonymous

      You only got 1 quote on the #testchn, so should read like:

      _TYPE_CHANNEL, '#testchn', $data->nick

       
    • Nobody/Anonymous

      Sorry, sorry, sorry...

      I made a mistake during copying and pasting my code...

      Line 10 is

      $irc->message(SMARTIRC_TYPE_CHANNEL, '#testchn', $data->nick.': no I don't like tests!');

      as proper quote.

      Again, how do I solve this problem?

       
    • Theodore Stavrianos

      Proper code should be:
      $irc->message(SMARTIRC_TYPE_CHANNEL, '#testchn', $data->nick.': no I don' . "'" . 't like tests!');
      the quote on the middle mixed it up.

       
    • Nobody/Anonymous

      $irc->message(SMARTIRC_TYPE_CHANNEL, '#testchn, $data->nick.': no I don\'t like tests!');

      You have to hide special letters with backslashes, so the php parser ignores them.

      X

       

Log in to post a comment.