This is a great thing to spice up your channels - grouphug.us confessions.
It will display a random confession everytime a user uses "/confess" command.
Create confess.class.php inside src/commands with following code:
- Code: Select all
- <?php
 require_once(dirname(__FILE__)."/../pfccommand.class.php");
 require(dirname(__FILE__).'/../htmlParser/simple_html_dom.php');
 class pfcCommand_confess extends pfcCommand
 {
 var $usage = "/confess";
 function run(&$xml_reponse, $p)
 {
 $clientid = $p["clientid"];
 $param = $p["param"];
 $sender = $p["sender"];
 $recipient = $p["recipient"];
 $recipientid = $p["recipientid"];
 
 $c =& pfcGlobalConfig::Instance();
 $u =& pfcUserConfig::Instance();
 $ct =& pfcContainer::Instance();
 $contents = file_get_contents('http://confessions.grouphug.us/random');
 $html = new simple_html_dom();
 $html->load($contents);
 $div = $html->find('[class*=node-confession]', 0);
 $inner = $div->innertext;
 $html->load($inner);
 $p = $html->find('[class*=content]', 0);
 $text = $p->plaintext;
 $message = $text;
 $ct->write($recipient, "*me*", $this->name, $u->getNickname().": ".$message);
 }
 }
 ?>
Download simple_html_dom.php from:
http://sourceforge.net/projects/simplehtmldom/
and place it into (you can change this, just remember to update confess class):
src/htmlParser
Enjoy!

