| 1 |
<?php |
<?php |
| 2 |
// $Id: bot_factoid.module,v 1.1.2.6 2007/11/09 14:35:12 morbus Exp $ |
// $Id: bot_factoid.module,v 1.1.2.6.2.1 2008/04/09 02:02:32 morbus Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 14 |
case 'irc:features': |
case 'irc:features': |
| 15 |
return array(t('Factoids')); |
return array(t('Factoids')); |
| 16 |
case 'irc:features#factoids': |
case 'irc:features#factoids': |
| 17 |
return t('Set factoids with "BOTNAME: cats are furry", "BOTNAME: Drupal is great.", "No, BOTNAME, Morbus is awesome.", "BOTNAME: Drupal is also powerful.", "BOTNAME: cheer is <action>cheers for !who in !channel!", or "BOTNAME: ping is <reply>WHAT?!". Retrieve factoids with: "Drupal?" or "BOTNAME: cheer!" Forget factoids with "BOTNAME: forget ping". Factoids can be browsed online at <!url>.', array('!url' => url('bot/factoid', array('absolute' => TRUE)))); |
return t('Set factoids with "BOTNAME: cats are furry", "BOTNAME: Drupal is great.", "No, BOTNAME, Morbus is awesome.", "BOTNAME: Drupal is also powerful.", "BOTNAME: cheer is <action>cheers for !who in !channel!", or "BOTNAME: ping is <reply>WHAT?!". Retrieve factoids with: "Drupal?" or "BOTNAME: cheer!" Forget factoids with "BOTNAME: forget ping". Factoids are also online at <!url>.', array('!url' => url('bot/factoid', array('absolute' => TRUE)))); |
| 18 |
case 'bot/factoid': |
case 'bot/factoid': |
| 19 |
return '<p>'. t('Browse all the factoids the bot knows about.') .'</p>'; |
return '<p>'. t('Browse all the factoids the bot knows about.') .'</p>'; |
| 20 |
case 'admin/settings/bot/factoid': |
case 'admin/settings/bot/factoid': |
| 25 |
/** |
/** |
| 26 |
* Implementation of hook_menu(). |
* Implementation of hook_menu(). |
| 27 |
*/ |
*/ |
| 28 |
function bot_factoid_menu($may_cache) { |
function bot_factoid_menu() { |
| 29 |
$items['bot/factoid'] = array( |
$items['bot/factoid'] = array( |
| 30 |
'access arguments' => array('access content'), |
'access arguments' => array('access content'), |
| 31 |
'description' => "Browse all the factoids the bot knows about.", |
'description' => "Browse all the factoids the bot knows about.", |
| 227 |
// if "also" starts the statement, we're adding. |
// if "also" starts the statement, we're adding. |
| 228 |
if (preg_match("/^also\s+/i", $statement)) { |
if (preg_match("/^also\s+/i", $statement)) { |
| 229 |
$statement = preg_replace("/^also\s+/i", '', $statement); |
$statement = preg_replace("/^also\s+/i", '', $statement); |
| 230 |
|
print $statement; |
| 231 |
} else { bot_factoid_delete($subject); } |
} else { bot_factoid_delete($subject); } |
| 232 |
|
|
| 233 |
db_query("INSERT INTO {bot_factoid} SET subject = '%s', is_are = '%s', statement = '%s'", $subject, $is_are, $statement); |
db_query("INSERT INTO {bot_factoid} SET subject = '%s', is_are = '%s', statement = '%s'", $subject, $is_are, $statement); |