collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Quotes output to IRC  (Read 1865 times)

0 Members and 1 Guest are viewing this topic.

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Quotes output to IRC
« 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".

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Quotes output to IRC
« Reply #1 on: August 22, 2006, 10:18:37 pm »
As far as it relaying to irc... I recently did that.

Where it says
Code: [Select]
/*
      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
Code: [Select]
$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:
Code: [Select]
/*
        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:
Code: [Select]
/*
        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()

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Quotes output to IRC
« Reply #2 on: August 22, 2006, 11:26:20 pm »
works great thanks.. to sync things up though I did this:

Code: [Select]
function gc($name, $msg)
{
    $quote = $this -> process_command($name, $msg);
    $this -> bot -> send_gc($quote);
    $this -> bot -> commands["tell"]["irc"] -> irc_send_local($quote);
}

Code: [Select]
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?

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Quotes output to IRC
« Reply #3 on: August 23, 2006, 12:43:30 am »
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.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 517
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal