Exemple #1
0
/**
* Start function for retrieving bot reply
*
* Checks to see if bot exists, if so calls reply() to get the repons to the user's input.
*
* @uses lookupbotid()
* @uses reply()
*
* @param string $userinput          The user's input
* @param integer $uniqueid          The user's session ID
* @param string $botname            The bot's name, if no name selected the default value is "TestBot".
*
* @return string                    The bot's reply. 
*/
function replybotname($userinput, $uniqueid, $botname = "TestBot")
{
    $botid = lookupbotid($botname);
    if ($botid == -1) {
        print "I don't know that bot: {$botname}<BR>\n";
    } else {
        return reply($userinput, $uniqueid, $botid);
    }
}
/**
* Start function for retrieving bot reply
*
* Checks to see if bot exists, if so calls reply() to get the repons to the user's input.
*
* @uses lookupbotid()
* @uses reply()
*
* @param string $userinput          The user's input
* @param integer $uniqueid          The user's session ID
* @param string $botname            The bot's name, if no name selected the default value is "TestBot".
*
* @return string                    The bot's reply.
*/
function replybotname($userinput, $uniqueid, $botname)
{
    /*
      $userinput = eregi_replace("^\/to L_PRIV_PM", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/msg L_PRIV_PM", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/wisp L_PRIV_WISP", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/whisp L_PRIV_WISP", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/to  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/msg  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/wisp  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/whisp  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/to  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/msg  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/wisp  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/whisp  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = ereg_replace("^\> ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
    */
    $userinput = preg_replace("/^\\/to L_PRIV_PM/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/msg L_PRIV_PM/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/wisp L_PRIV_WISP/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/whisp L_PRIV_WISP/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/to Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/msg Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/wisp Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/whisp Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/to /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/msg /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/wisp /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/whisp /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\> /", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/&#39;/", "'", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $botid = lookupbotid($botname);
    if ($botid == -1) {
        #		print "There is no such a bot: $botname<br />\n";
        return reply("There is no such a bot <b>{$botname}</b> loaded in the database.<br />\nPlease make sure the bot is fully loaded into the database.<br />\nNotify the chat administrator about this message!", $uniqueid, $botid);
    } else {
        return reply($userinput, $uniqueid, $botid);
    }
}
Exemple #3
0
/**
* Start function for retrieving bot reply
*
* Checks to see if bot exists, if so calls reply() to get the repons to the user's input.
*
* @uses lookupbotid()
* @uses reply()
*
* @param string $userinput          The user's input
* @param integer $uniqueid          The user's session ID
* @param string $botname            The bot's name, if no name selected the default value is "octavius".
*
* @return string                    The bot's reply. 
*/
function replybotname($userinput, $uniqueid, $botname = "octavius")
{
    $botid = lookupbotid($botname);
    if ($botid == -1) {
        //print "I don't know that bot: $botname<BR>\n";
    } else {
        return reply($userinput, $uniqueid, $botid);
    }
}