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: Improving relay over IRC  (Read 11885 times)

0 Members and 3 Guests are viewing this topic.

Offline Nytridr

  • BeBot Expert
  • ****
  • Posts: 262
  • Karma: +0/-0
    • Rising Sun
Re: Improving relay over IRC
« Reply #15 on: May 06, 2007, 06:33:14 am »
seems like privgroup isnt being relayed over the IRC channel and the IRC channel isnt being relayed to privgroup either..
Co-Prez of Rising Sun RK1 (1st & only org I will ever belong to)

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: Improving relay over IRC
« Reply #16 on: May 06, 2007, 09:02:52 am »
i think that's located in the config now.
you should be able to turn it on/off

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Improving relay over IRC
« Reply #17 on: May 06, 2007, 10:30:25 am »
Yes, it's a setting now, irc_chat. Default is gc.

Offline Nytridr

  • BeBot Expert
  • ****
  • Posts: 262
  • Karma: +0/-0
    • Rising Sun
Re: Improving relay over IRC
« Reply #18 on: May 06, 2007, 03:37:55 pm »
appreciate it.. for some reason I didnt see it when I was looking at the settings irc lastnight..
Co-Prez of Rising Sun RK1 (1st & only org I will ever belong to)

Offline Nytridr

  • BeBot Expert
  • ****
  • Posts: 262
  • Karma: +0/-0
    • Rising Sun
Re: Improving relay over IRC
« Reply #19 on: May 06, 2007, 07:45:17 pm »
I am assuming this is in the IRC part of the bot.. since when I do not have the IRC mod going this dont happen..

the bot will build up using about 20+ megs of ram and just hang there..

Code: [Select]
[06-May-2007 10:48:49] PHP Fatal error:  Allowed memory size of 20971520 bytes exhausted (tried to allocate 8 bytes) in C:\aobots\RS\rsbot\Sources\MySQL.php on line 146

[06-May-2007 11:19:12] PHP Fatal error:  Allowed memory size of 20971520 bytes exhausted (tried to allocate 35 bytes) in C:\aobots\RS\rsbot\Sources\MySQL.php on line 164

[06-May-2007 11:31:53] PHP Fatal error:  Allowed memory size of 20971520 bytes exhausted (tried to allocate 96 bytes) in C:\aobots\RS\rsbot\Sources\MySQL.php on line 146

Now this didnt start happening till again till I turned on IRC Chat to both instead of GC.. 

Co-Prez of Rising Sun RK1 (1st & only org I will ever belong to)

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Improving relay over IRC
« Reply #20 on: May 06, 2007, 08:05:54 pm »
Uhm...

No clue, it shouldn't use more memory really...

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Improving relay over IRC
« Reply #21 on: May 06, 2007, 08:19:16 pm »
I've checked the code that I added, and besides a few instances of old settings names that I forgot to switch the only thing that could eat some memory is the regex checks. But the garbage collection should clean that up after the function calls are over...

Offline Nytridr

  • BeBot Expert
  • ****
  • Posts: 262
  • Karma: +0/-0
    • Rising Sun
Re: Improving relay over IRC
« Reply #22 on: May 06, 2007, 09:07:14 pm »
I've checked the code that I added, and besides a few instances of old settings names that I forgot to switch the only thing that could eat some memory is the regex checks. But the garbage collection should clean that up after the function calls are over...

IDK this is like a doctor problem.. when your at home you feel sick and think you need to go to the docs.. but when you get there you feel fine and the doc says theres nothing wrong..

well guess what.. mem is stable now and even though each bot is using differnt ram ammounts they are not going up and are staying pretty stable.. even though I have seen the bot still spamming off and on.. but I am woundering  if it has something to do with what ever is going on....  the differnt org bots are using between 5meg to 15megs right now.. all differnt.. not sure why either.
Co-Prez of Rising Sun RK1 (1st & only org I will ever belong to)

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Improving relay over IRC
« Reply #23 on: June 25, 2007, 12:30:44 am »
I had added a few things to my IRC module in .2 but can't seem to get them working in .3.4 so thought I'd see what you guys think.  I'm sure its just something with the way .3.x handles stuff differently.  I changed the !online to show difference in org chat and private group and added a whois.

Code: [Select]
/*
* Gets called when someone does !online
*/
function irc_online(&$irc, &$data)
{
if (isset($this -> bot -> commands["tell"]["online"]))
{
foreach($this -> bot -> commands["tell"]["online"] -> guild as $player)
$nick[$player[0]] = 1;
ksort($nick);
$msg = count($nick) . " org members online: ";
foreach ($nick as $name => $val)
$msg .= $name . ", ";

foreach($this -> bot -> commands["tell"]["online"] -> pgroup as $guestplayer)
$guestnick[$guestplayer[0]] = 1;
ksort($guestnick);
$guestmsg = count($guestnick) . " players in guest channel: ";
foreach ($guestnick as $guestname => $val)
$guestmsg .= $guestname . ", ";


$this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, $msg);
$this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, $guestmsg);
}
else
$this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, "Online module not installed.");
}

/*
        * Whois Function - Used exclusively for IRC to strip color codes and add IRC specific coding
        */
function whois_player($name)
{
$content = $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml");
$who["nick"] = $this -> bot -> xmlparse($content, "nick");
$who["firstname"] = $this -> bot -> xmlparse($content, "firstname");
$who["lastname"] = $this -> bot -> xmlparse($content, "lastname");
$who["level"] = $this -> bot -> xmlparse($content, "level");
$who["gender"] = $this -> bot -> xmlparse($content, "gender");
$who["breed"] = $this -> bot -> xmlparse($content, "breed");
$who["profession"] = $this -> bot -> xmlparse($content, "profession");
$who["faction"] = $this -> bot -> xmlparse($content, "faction");
$who["rank"] = $this -> bot -> xmlparse($content, "rank");
$who["org"] = $this -> bot -> xmlparse($content, "organization_name");
$who["at_name"] = $this -> bot -> xmlparse($content, "defender_rank");
$who["at"] = $this -> bot -> xmlparse($content, "defender_rank_id");

if (!empty($who["nick"]))
{
$at = "(AT " . $who["at"] . " - " . $who["at_name"] . ") ";
$result = "\"" . $who["nick"] . "\"";
if (!empty($who["firstname"]) && ($who["firstname"] != "Unknown"))
$result = $who["firstname"] . " " . $result;
if (!empty($who["lastname"]) && ($who["lastname"] != "Unknown"))
$result .= " " . $who["lastname"];

$result .= " is a level " . $who["level"] . " " . $at . $who["gender"] . " " . $who["breed"] . " " . $who["profession"] . ", " . $who["faction"];
if (!empty($who["rank"]))
$result .= ", " . $who["rank"] . " of " . $who["org"] . ".";
else
$result .= ".";
}
else
$result = "www.anarchy-online.com was too slow to respond.";

return $result;
}

/*
* Gets called when someone does !whois
*/
function irc_whois(&$irc, &$data)
{
if (isset($this -> bot -> commands["tell"]["whois"]))
{
   preg_match("/^" . $this -> bot -> commpre . "whois (.+)$/i", $data -> message, $info);
                   $info[1] = ucfirst(strtolower($info[1]));

   if ($this -> bot -> aoc -> get_uid($info[1]))
      $this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, $this -> whois_player($info[1]));
                   else
       $this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, "Player " . $info[1] . " does not exist.");
}
else
    $this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, "Whois module not installed.");
}

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Improving relay over IRC
« Reply #24 on: June 25, 2007, 12:42:10 am »
Online no longer stores anything in arrays, so reading the online -> guild array won't work.

You have to query the online table, like the 0.3.4 version does.
Code: [Select]
$online = $this -> bot -> db -> select("SELECT nickname FROM #___online WHERE botname = '" . $this -> bot -> botname . "' AND status_gc = 1 ORDER BY nickname ASC");The $online array contains the nicknames of all online buddies then.

Replace status_gc = 1 with status_pg to get charaters in private group.

For the whois you should call $this -> bot -> whois -> lookup($name), the whois cache is integrated in 0.3.4 already. Then just adapt your output generation to the slightly different array names used in the return, check core/Whois.php for a listing. It should work otherwise.

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Improving relay over IRC
« Reply #25 on: June 25, 2007, 01:26:41 am »
Thanks, I'll give that a try.

Offline Tyrence

  • BeBot User
  • **
  • Posts: 41
  • Karma: +0/-0
Re: Improving relay over IRC
« Reply #26 on: August 26, 2011, 03:16:09 am »
I am finally getting around to having this implemented on Budabot so it will finally be compatible.  I was wondering if anyone is using this on their Bebot install that I could test with to make sure it all works?

 

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