BeBot - An Anarchy Online and Age Of Conan chat automaton
Development => Coding and development discussion => Topic started by: Snarfblatt on August 22, 2006, 09:09:25 pm
-
I have the quotes module installed. Is there a way to output the quotes to IRC? Or better yet.. is there a way to make "!quotes" work from IRC like "!online" and "!is".
-
As far as it relaying to irc... I recently did that.
Where it says
/*
This gets called on a msg in the guildchat with the command
*/
function gc($name, $msg)
{
$this -> bot -> send_gc($this -> process_command($name, $msg));
}
Add this right after the send_gc part
$this -> bot -> commands["tell"]["irc"] -> irc_send_local($this -> process_command($name, $msg));
If you are using the cron part (having a quote relay every x number of mins) you can add it there too.. but how I have it it shows a different quote in irc than it does in-game since it grabs a random one for each. But here is the change I made... Change this:
/*
This is cron()!
*/
function cron()
{ // Start function cron()
if ($this -> nextquote < time() && $this -> settings['AUTO'] == 1)
{ // Start if()
// Set time of next quote output.
$this -> nextquote = $this -> nextquote + ($this -> settings['INTERVAL']*60);
switch ($this -> settings['CHANNEL'])
{ // Start switch
case "GC":
$this -> bot -> send_gc($this -> send_quote(-1));
break;
case "PGROUP":
$this -> bot -> send_pgroup($this -> send_quote(-1));
break;
case "BOTH":
$this -> bot -> send_gc($this -> send_quote(-1));
$this -> bot -> send_pgroup($this -> send_quote(-1));
break;
} // End Switch
} // End if()
} // End function cron()
To this:
/*
This is cron()!
*/
function cron()
{ // Start function cron()
if ($this -> nextquote < time() && $this -> settings['AUTO'] == 1)
{ // Start if()
// Set time of next quote output.
$this -> nextquote = $this -> nextquote + ($this -> settings['INTERVAL']*60);
switch ($this -> settings['CHANNEL'])
{ // Start switch
case "GC":
$this -> bot -> send_gc($this -> send_quote(-1));
$this -> bot -> commands["tell"]["irc"] -> irc_send_local($this -> send_quote(-1));
break;
case "PGROUP":
$this -> bot -> send_pgroup($this -> send_quote(-1));
break;
case "BOTH":
$this -> bot -> send_gc($this -> send_quote(-1));
$this -> bot -> send_pgroup($this -> send_quote(-1));
break;
} // End Switch
} // End if()
} // End function cron()
-
works great thanks.. to sync things up though I did this:
function gc($name, $msg)
{
$quote = $this -> process_command($name, $msg);
$this -> bot -> send_gc($quote);
$this -> bot -> commands["tell"]["irc"] -> irc_send_local($quote);
}
function cron()
{
...
$quote = $this -> send_quote(-1);
$this -> bot -> send_gc($quote);
$this -> bot -> commands["tell"]["irc"] -> irc_send_local($quote);
...
}
Now.. is there anyway to call the !quote command from IRC.. or is that opening up a can of worms?
-
good thinking on that, no clue why I didn't think of that minor change.
As far as calling it from IRC, that would take some mods in the IRC.php file. You can see the irc_is and irc_online functions as a reference for it.