The bot works great - But one question.

Help
2006-05-12
2013-04-09
  • I am trying to get the bot to message a nick name and send a message. How would I correctly add this?

    I want something like !msg Bob hello bob

     
    • I use something like this:

      if (strtolower(substr($msgwithoutident, 0, 4)) == '!msg')
      {
      $message = substr($msgwithoutident, 5, strlen($msgwithoutident)-5);
      list($nick, $msg) = explode(" ", $message, 2);
      $irc->message(SMARTIRC_TYPE_CHANNEL, $nick, $msg);
      }

      That code will first see if a message starts with "!msg". If so it will then explode the rest of the line to get the nick and the message and then sends the private message to the nick.