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: fiddling with guildrelay  (Read 3981 times)

0 Members and 1 Guest are viewing this topic.

Offline kuznechik

  • Contributor
  • *******
  • Posts: 60
  • Karma: +0/-0
fiddling with guildrelay
« on: February 27, 2007, 11:16:20 am »
First of all I must say that my bots using different prefix than "!". So after quick search for "!gcr" I've found 2 errors.
Code: [Select]
--- AutoMsg.php.orig    Wed Feb 21 21:44:28 2007
+++ AutoMsg.php Tue Feb 27 13:04:25 2007
@@ -110,7 +110,7 @@
                $this -> bot -> db -> query("INSERT INTO #___auto_msg (type, towho, msg) VALUES ('gc', '', 'Bot is online :: System Ready')");
                if ($this -> bot -> guild_relay_target)
                {
-                       $this -> bot -> db -> query("INSERT INTO #___auto_msg (type, towho, msg) VALUES ('relay', '', '!gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": Bot is online :: System Ready :: Guild Relay Active')");
+                       $this -> bot -> db -> query("INSERT INTO #___auto_msg (type, towho, msg) VALUES ('relay', '', '" . $this -> bot -> commpre . "gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": Bot is online :: System Ready :: Guild Relay Active')");
                }

        }

Code: [Select]
--- Shutdown.php.orig   Wed Feb 21 21:49:50 2007
+++ Shutdown.php        Tue Feb 27 13:08:58 2007
@@ -73,7 +73,7 @@
                                $this -> bot -> send_tell($name, "The bot is shutting down.");
                                if ($this -> bot -> guild_relay_target)
                                {
-                                       $this -> bot -> send_tell($this -> bot -> guild_relay_target, "!gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": The bot is shutting down :: Guild relay disabled", 0, false);
+                                       $this -> bot -> send_tell($this -> bot -> guild_relay_target, $this -> bot -> commpre . "gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": The bot is shutting down :: Guild relay disabled", 0, false);
                                }
                                $this -> bot -> disconnect();
                                die("The bot has been shutdown.\n");
@@ -85,7 +85,7 @@
                                $this -> bot -> send_tell($name, "The bot is restarting.");
                                if ($this -> bot -> guild_relay_target)
                                {
-                                       $this -> bot -> send_tell($this -> bot -> guild_relay_target, "!gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": The bot is restarting :: Guild relay disabled", 0, false);
+                                       $this -> bot -> send_tell($this -> bot -> guild_relay_target, $this -> bot -> commpre . "gcr [" . $this -> bot -> guildname . "] " . $this -> bot -> botname . ": The bot is restarting :: Guild relay disabled", 0, false);
                                }

                                $this -> bot -> disconnect();


I also didn't liked how I need to add other bot to members and somehow keep him from being cleaned from members list, so I've added tell2.

Code: [Select]
--- GuildRelay_GUILD.php.orig   Tue Feb 27 13:12:29 2007
+++ GuildRelay_GUILD.php        Thu Feb 22 00:47:25 2007
@@ -38,6 +38,7 @@
 $guildrelay = new GuildRelay($bot);

 $commands["tell"]["gcr"] = &$guildrelay;
+$commands["tell2"]["gcr"] = &$guildrelay;
 $commands["gc"]["guildrelay"] = &$guildrelay;
 $commands["connect"][] = &$guildrelay;

@@ -68,6 +69,15 @@
        This gets called on a tell with the command
        */
        function tell($name, $msg)
+       {
+               if (preg_match("/^" . $this -> bot -> commpre . "gcr (.+)$/im", $msg, $info) &&
+               ($this -> guildbot == strtolower($name)))
+               {
+                       $this -> bot -> send_gc($info[1]);
+               }
+       }
+
+       function tell2($name, $msg)
        {
                if (preg_match("/^" . $this -> bot -> commpre . "gcr (.+)$/im", $msg, $info) &&
                ($this -> guildbot == strtolower($name)))

Modifying tell to tell2 resulted in bot restart... Didn't digged why, just added tell2...

To be continued
Kuznechik, proud bot admin of Disciples of Omni-Tek, Rimor.

Offline kuznechik

  • Contributor
  • *******
  • Posts: 60
  • Karma: +0/-0
Another addition - guild_relaying of privgroup
« Reply #1 on: February 27, 2007, 02:21:39 pm »
Due to some people being in baby org we have relay with and some org-friends hanging in privgroup I've got request to relay messages between it.
Here is result:
Code: [Select]
--- GuildRelay_GUILD.php.p1     Thu Feb 22 00:47:25 2007
+++ GuildRelay_GUILD.php        Tue Feb 27 16:08:15 2007
@@ -74,6 +74,9 @@
                ($this -> guildbot == strtolower($name)))
                {
                        $this -> bot -> send_gc($info[1]);
+                    if (isset($this -> bot -> commands["privgroup"]["relay"]))
+                       $this -> bot -> send_pgroup($info[1]);
                }
        }

@@ -83,6 +86,8 @@
                ($this -> guildbot == strtolower($name)))
                {
                        $this -> bot -> send_gc($info[1]);
+                    if (isset($this -> bot -> commands["privgroup"]["relay"]))
+                       $this -> bot -> send_pgroup($info[1]);
                }
        }

@@ -120,6 +125,12 @@
                if (strtolower($name) != strtolower($this -> bot -> botname))
                {
                        $tell = "<pre>gcr [" . $this -> bot -> guildname . "] " . $name . ": " . $msg;
+                       $this -> bot -> send_tell($this -> guildbot, $tell, 0, false);
+               }
+               else if (preg_match("/^<font color=#([0-9a-fA-F]+)>\[Guest\](.+)$/i", $msg, $info) &&
+                       (isset($this -> bot -> commands["privgroup"]["relay"])))
+               {
+                       $tell = "<pre>gcr [" . $name . "-guest]:" . $info[2];
                        $this -> bot -> send_tell($this -> guildbot, $tell, 0, false);
                }
        }
« Last Edit: February 27, 2007, 02:32:33 pm by kuznechik »
Kuznechik, proud bot admin of Disciples of Omni-Tek, Rimor.

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: fiddling with guildrelay
« Reply #2 on: February 28, 2007, 05:29:04 pm »
Nerf your text editor ;)

220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: fiddling with guildrelay
« Reply #3 on: February 28, 2007, 06:53:55 pm »
Nerf your text editor ;)

No nerfing required. Learn diff and patch.  ;D

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: fiddling with guildrelay
« Reply #4 on: February 28, 2007, 08:11:47 pm »
No thanks, Notepad2 ftw :p
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

 

* 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: 173
  • 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