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

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

Author Topic: same output of ig/IRC !online command  (Read 4561 times)

0 Members and 1 Guest are viewing this topic.

Offline Tichy

  • BeBot User
  • **
  • Posts: 42
  • Karma: +0/-0
same output of ig/IRC !online command
« on: September 12, 2007, 10:56:54 am »
I have multiple org bots running on the same database and relaying to each other. The !online command is configured to show the buddies of all bots. If one does  !online from IRC you will only get the online buddies of the bot relaying to IRC.

Small patch to work like the OnlineDisplay module:

Code: [Select]
--- DNWCom/modules/IRC.php      2007-07-29 19:20:45.000000000 +0200
+++ FECom/modules/IRC.php       2007-09-11 14:19:17.000000000 +0200
@@ -800,8 +800,27 @@
        */
        function irc_online(&$irc, &$data)
        {
-               $online = $this -> bot -> db -> select("SELECT nickname FROM #___online WHERE botname = '" . $this -> bot -> botname
-               . "' AND status_gc = 1 ORDER BY nickname ASC");
+               if ($this -> bot -> settings -> get("Online", "Otherbots") != "")
+               {
+                       $bots = explode(",", $this -> bot -> settings -> get("Online", "Otherbots"));
+                       $botnames = array();
+                       foreach ($bots as $bot)
+                       {
+                               // Only use valid botnames
+                               if ($this -> bot -> aoc -> get_uid(trim($bot)))
+                               {
+                                       $botnames[] = "botname = '" . trim($bot) . "'";
+                               }
+                       }
+                       $botnames[] = "botname = '" . $this -> bot -> botname . "'";
+                       $botstring = "(" . implode(" OR ", $botnames) . ")";
+               }
+               else
+               {
+                       $botstring = "botname='" .  $this -> bot -> botname . "'";
+               }
+
+               $online = $this -> bot -> db -> select("SELECT nickname FROM #___online WHERE $botstring AND status_gc = 1 ORDER BY nickname ASC");
                if (empty($online))
                {
                        $msg = "Nobody online!";

Maybe there is some additional checking needed if the OnlineDisplay module is installed.


Regards,
Tichy
« Last Edit: September 12, 2007, 11:10:37 am by Tichy »

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


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


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

* Who's Online
  • Dot Guests: 107
  • 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