BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Module Requests => Topic started by: Oplink on February 21, 2005, 07:50:18 pm

Title: IRC chat relay
Post by: Oplink on February 21, 2005, 07:50:18 pm
Would like an IRC chat relay, so we can see GC, and send tells to GC from a IRC channel.
Title: IRC chat relay
Post by: Plac3bo on August 30, 2005, 10:57:24 am
I really need this, the bot is great and I got it up and running at once. But without the IRC relay its not "good enough". we have alot of people hanging in our irc channel during work hours to chat and help with information during daytime.

Any chance this could be implelemented?  :D
Title: IRC chat relay
Post by: Zacix on August 30, 2005, 11:40:56 am
What's wrong with AORC+ :D
Title: IRC chat relay
Post by: Plac3bo on August 30, 2005, 11:43:06 am
whats that? :)
Title: IRC chat relay
Post by: Plac3bo on August 30, 2005, 11:48:40 am
oh! doh :)
well, first off, its for 1 person, and second off, its windows, and thrid thing, it doesnt run on most work connections, most ppl can only ssh out on oneport and use that to ssh home to their servers with irssi :)
I need a relay from the bot, I know there are bots that does that, and I cant see why its not in this one. It works great, and I really like the bots and the stuff it can do, so I would love to run bebot. But without the irclink I fear that someone might setup a ign bot :(
Title: IRC chat relay
Post by: Khalem on August 30, 2005, 08:15:29 pm
IRC Relay is on my own wishlist aswell. So far i havent found time to work on it myself.

For now we have been using an IGN bot for the relay, but its quite memory expensive to run IGN bot merely for the IRC relay :\
Title: IRC chat relay
Post by: Plac3bo on August 30, 2005, 10:25:15 pm
Is there anyone out there that can fix it? isnt it possible to look at ign bots code for irc-relay and make it into a bebot module?
Title: IRC chat relay
Post by: iriche on August 31, 2005, 01:44:52 am
Quote from: "Plac3bo"
Is there anyone out there that can fix it? isnt it possible to look at ign bots code for irc-relay and make it into a bebot module?


I have already tried that but it lags to much
Title: IRC chat relay
Post by: Plac3bo on September 07, 2005, 02:51:42 pm
wish someone could implelement it.. I hate running IGN aswell only for the ircspam. I tried looking at the code again, but its still a bit to cryptic for me.. if there was a way to switch of ALL other functionality on IGN it would be that bad, but now they keep doulbe spamin logon and logoff messages.
Title: IRC chat relay
Post by: Zacix on September 07, 2005, 05:03:02 pm
Quote from: "Plac3bo"
wish someone could implelement it.. I hate running IGN aswell only for the ircspam. I tried looking at the code again, but its still a bit to cryptic for me.. if there was a way to switch of ALL other functionality on IGN it would be that bad, but now they keep doulbe spamin logon and logoff messages.


The double spamming of logon/logoff should be easy to remove. Seriously, if you bothered to take 5 mins to look through your loaded modules and/or how IGN works, this is no problem at all (On bebot have a look at notify.php or if you use my online.php (which you shouldn't since you're running a guildbot) check that one).

When it comes to IRC module, make it yourself...or at least start on something. I guess it's something about demands/needs. I myself have absolutely no use for it whatsoever, so I'm not gonna do the work, but I can assist you on it or at least share my thoughts about it. It should be very easy to do. If you poke around 2mins on www.php.net, you'll realize that PHP has it's own subet of functions for IRC connections and such things. I ca understand that it might be a bit cryptic if you've never programmed at all before, but if you have, there's no excuse to not start on it yourself ;)
Title: IRC chat relay
Post by: Blondengy on September 07, 2005, 09:03:23 pm
Since a lot of people seem to really want this I might take a look at it in the comeing week if noone else does - but due to time problems atm (big exams comeing up) I can't promise anyhting - especially since my account is no longer active and I'd have to test on a freebie account (got to find a guild with a lvl 1 char to test in :?)
Title: IRC chat relay
Post by: Khalem on September 08, 2005, 03:16:42 am
I'll get you hooked up Blond :)
Title: IRC chat relay
Post by: Blondengy on September 08, 2005, 03:06:41 pm
I got sick which means that I can't concentrate on the stuff I have to learn :(
On the upside codeing needs a lot less concentration than learning stuff so I got to work on the IRC Module....

Here's the first beta. This is just intended to test if it works for most people, gather feedback on bugs and on further features needed.

Copy the IRC.php to your bebot/modules directory and the other files to the bebot/IRC directory.

First thing you'll have to do is configure it once the bot is running again:
!irc server <servername>
!irc port <port> (this defaults to 6667 if you don't enter anything
!irc channel <yourchan> (this defaults to #bebot)

These settings will not get lost on a restart of the bot, so you only have to do this the very first time.

Once thats set up do:
!irc connect

And to disconnect again:
!irc disconnect


The files can be found here (http://bebot.fieses.net/files/ircbeta1.tar.gz).

Just post any feedback here...
Title: IRC chat relay
Post by: Plac3bo on September 08, 2005, 09:54:04 pm
Ok, I set it up, 2 things I can see thats missing right now..

!irc channelkey <key for irc channel>
!irc nick <nick for bot on irc>

other then that I dont know, seems ok
Title: IRC chat relay
Post by: Blondengy on September 08, 2005, 11:29:21 pm
clicky (http://bebot.fieses.net/files/ircbeta2.tar.gz)

Added:
!irc nick <name> (defaults to botname)
!irc channelkey <key> (defaults to empty)
Title: IRC chat relay
Post by: Plac3bo on September 09, 2005, 12:32:21 am
ok, it works! :) great :)

thanks, using it now, and I'll let you know if anything comes up

only thing I noticed..

 select * from settings;
+---------------+-------+
| setting       | value |
+---------------+-------+
| auto_invite   | 0     |
| points_tomain | 1     |
+---------------+-------+
2 rows in set (0.00 sec)


it doesnt add my irc settings...

one last thing.. a possibility to remove the [GUILD] infront of the spam on irc, its enough that its like: <@botname> drdyrego: it works

:)

great work dude!

much lub!


next project, adding AI levels to login  :twisted:
Title: IRC chat relay
Post by: Khalem on September 09, 2005, 08:48:58 am
Quote from: "Plac3bo"

next project, adding AI levels to login  :twisted:


Already done for the next version ;)
Title: IRC chat relay
Post by: Plac3bo on September 09, 2005, 09:55:00 am
one more thing, it doesnt spam the "logged on" and "logged off" messages, thats important :)
Title: IRC chat relay
Post by: Blondengy on September 09, 2005, 10:51:54 am
*CLICK (http://bebot.fieses.net/files/ircbeta3.tar.gz)*

Added:
!irc announce (on|off) (Announces joining & leaving defaults to "on")
!irc ircprefix <prefix> (Prefix in irc defaults to "[GUILD]")
!irc guildprefix <prefix> (Prefix in guildchat defaults to "[IRC]")
Title: IRC chat relay
Post by: Khalem on September 09, 2005, 05:59:39 pm
Missing is also automatic reconnect if disconnect :)

Looking good so far.
Title: IRC chat relay
Post by: Blondengy on September 09, 2005, 06:52:51 pm
*click*click* (http://bebot.fieses.net/files/ircbeta4.tar.gz)

!irc reconnect (on|off) (Auto reconnect on IRC disconnect - defaults to "on")
Title: IRC chat relay
Post by: Khalem on September 10, 2005, 06:10:59 am
Looking very good :)

I cant confirm that the auto reconnect on startup is working as it wont save the settings across restart atm. Will have to look into whats causing it later.

Also would be nice if the IRC relay would relay guild chat relay (gees, too much relay) and vice versa.
Title: IRC chat relay
Post by: Blondengy on September 10, 2005, 09:49:23 am
You mean relay the stuff it gets from another bot over GC relay? do you mean that another bot is in GC doing the relay and it doesn't relay that stuff?
And I guess you also want to relay the IRC stuff back over GC relay?
And it still doesn't save the settings across startup? Now thats wierd, I thought I fixed it... (I can't really test any of these functions if they work properly before uploading >.<)
Maybe I can catch you awake sometime Khalem, but since you posted at 4:10am GMT I kinda doubt it. ;P
Title: IRC chat relay
Post by: Blondengy on September 10, 2005, 11:51:14 am
... (http://bebot.fieses.net/files/ircbeta5.tar.gz)

Definatly saves/loads settings now, definatly reconnects on disconnect, relays the guildrelay too but to get it to work you must set:

!irc relayguildname <name of other guild>
Title: IRC chat relay
Post by: Plac3bo on September 12, 2005, 01:05:03 am
I got one more.. in stead of posting
[link]some ingame item[/link]

on irc, it should post the link to auno or something.. like:
some ingame item (http://auno.org/theitemthingy)

 :D
Title: IRC chat relay
Post by: Blondengy on September 12, 2005, 03:03:58 pm
clk (http://bebot.fieses.net/files/ircbeta6.tar.gz)

!irc itemref (aodb|auno) (Change what site the itemref in IRC will point to. Defaults to aodb)
Title: IRC chat relay
Post by: Khalem on September 13, 2005, 08:13:11 am
*happy now*

IGN bot ditched and 40 megs of ram freed up :P

Minor nitpicking requests with the only things im missing (that arent really essential but nice)
- Ability to see who is online in guild with <prefix>online on IRC
- <prefix>is for IRC
- <prefix>whois for IRC
- Relaying of tower attack and victory messages to IRC
- Relaying of Alien attack and CC status messages to IRC

And thanx for getting around to doing the IRC relay blond :)  I owe you some beers.
Title: IRC chat relay
Post by: Plac3bo on September 13, 2005, 09:18:16 am
cant get the bot to connect with the latest version, and not getting any error messages in get bot screen either...

and getting this:

Warning: unpack(): Type H: outside of string in bebot/AOChat.php on line 711
Title: IRC chat relay
Post by: Blondengy on September 13, 2005, 08:15:16 pm
you mean you can't get the bot connected at all or just not with the newest IRC module?
That error msg you're getting is "normal"... something to do with PHP and AOChat.php
Title: IRC chat relay
Post by: Plac3bo on September 13, 2005, 11:01:39 pm
its working now :)

I deleted the module files and the irc dir, then unpacked the latest version and its working :)

2 more things that I have discovered.

The posibility to set the ircprefix and guildprefix to nothing isnt possible :)
and.. characters like <>" and such comes as the html code for them on irc...

really starting to move on to RC candidate for the irc module now :)
I love that you "came back from retirement" to program more features on the bot, BeBot is without a doubt the best bot I have tried. Thanks alot Blondengy!
Title: IRC chat relay
Post by: Plac3bo on September 14, 2005, 10:44:43 am
Im like the guy that never stops posting :)
1 "bug" .. the irc part spamms announcements, like this

Announce: IRRK News Flash: [link]Unicorns In Charge - Reaction[/link]

that shouldnt be there :)
Title: IRC chat relay
Post by: Blondengy on September 14, 2005, 01:04:02 pm
IRC (http://bebot.fieses.net/files/ircbeta7.tar.gz)

These should clear the prefix:
!irc ircprefix ""
!irc guildprefix ""

These now work in IRC:
!online
!is <player>

I think this is pretty much all the functionality I'm gonna add.
The IRRK news thingy: I guess you had problems with the bot at the start that it didn't display GC? Cause one of the fixes for that causes that bug :P Well, I hope it'll be fixed with BeBot 0.3.0.0 *looks at Khalem*
Title: IRC chat relay
Post by: Blondengy on September 19, 2005, 05:45:58 pm
!!!!! (http://bebot.fieses.net/viewtopic.php?p=664)

The official/final version which now also includes a help file.

Added command:
!irc chat (gc|pgroup|both)
This defaults to "gc".

Changed:
No longer guild-only since with "!irc chat pgroup" you can now make a relay between the privategroup and IRC. This means that the _GUILD has been removed from the name so don't forget to delete the old IRC_GUILD.php when using this new IRC.php! ;)
All commands are now admin-only.
Title: IRC chat relay
Post by: Plac3bo on September 27, 2005, 12:08:02 pm
well, theres a bug :)
some nicks on guildchat doesnt spam to irc
when I log in my alt Zrato, what he says doesnt show on irc...
Title: IRC chat relay
Post by: Blondengy on September 27, 2005, 06:15:20 pm
Did you add him on the "bot" list of the bot? Cause that could be a reason.
And if not does he show up in the bot's console?
Title: IRC chat relay
Post by: Plac3bo on September 27, 2005, 08:34:59 pm
Hes member of the guild and I get logged on and logged off messages.
hes also in the members table.
Title: IRC chat relay
Post by: Plac3bo on September 28, 2005, 11:37:57 pm
cant see the bot priv group either.. we usually have !relay on so alts can talk to guild. but on irc you cant see that.
Title: Re: IRC chat relay
Post by: Mephistobane on July 01, 2006, 11:32:39 am
can we get a new updated link to the official version of this?

link is broke :P
Title: Re: IRC chat relay
Post by: Blondengy on July 01, 2006, 12:56:41 pm
The newest version is included in the offical download of the bot.
I think its both in the 0.2.5 and the SVN version.
Title: Re: IRC chat relay
Post by: Zerovector on November 17, 2006, 06:35:24 pm
Necromancy! But I was just wondering if anyone has made !whois into their IRC module, that's one of the most handy IRC commands and yet it's nowhere to be found :)
Title: Re: IRC chat relay
Post by: Naturalistic on November 18, 2006, 12:56:09 am
I had implemented it on my old org bot... but since reformatting, backing bots up etc... it's lost somewhere in the DVDs.

I'll try to look for it. (I'm not sure if it's 100% or whether I was working on some bugs :P)
Title: Re: IRC chat relay
Post by: Zerovector on November 18, 2006, 04:21:56 pm
Super! Thanks in advance for the effort, Naturalistic :-*
Title: Re: IRC chat relay
Post by: Evereane on December 13, 2006, 11:26:46 pm
This is what I have working with mine...

Open IRC.php

Find $this -> irc -> setUseSockets(TRUE);
Under it, place...

Code: [Select]
...
$this -> irc -> registerActionhandler(SMARTIRC_TYPE_CHANNEL, $this -> bot -> commpre.'whois', $this -> bot -> commands["tell"]["irc"], 'irc_whois');
...

Then near the bottom (under the Function irc_part())

Code: [Select]
        /*
        * 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.");
}

I've had no issues... some of that may be extra coding I don't need, but it works  ;D

Edit: Just noticed the forum stripped the IRC Command codes for bold... oh well.
Title: Re: IRC chat relay
Post by: Nytridr on February 08, 2007, 11:09:29 pm
I have a little problem with someone post a linked item in org chat.. what the other orgs get from the IRC server is pretty much spam..

Code: [Select]
anyone got a Awakened Chest Symbiant, Support Unit Aban (http://aomainframe.net/showitem.asp?LowID=236136&HiID=236136&QL=180) for sale?

That is just one item.. can you imagain what it would be like with like 5 or 10 items listed at one time.. it isnt pretty and is very unreadble.. that was the very first post I seen when we got all our bots connected up is someone asking if anyone wanted... then a list of 9 differnt items..

is there a way to transfer through IRC what these items are with out all the additional spam..?

Nytridr

.3 svn ..
Title: Re: IRC chat relay
Post by: Wolfbiter on February 09, 2007, 03:36:04 am
no, plain and simple. I'll repeat it again so you wont ask any follow up questions along the lines of "but what if...?". It is not possible in any way at all.
Title: Re: IRC chat relay
Post by: Khalem on February 11, 2007, 02:00:42 am
Hrm. Should be possible. I'll have a look :)
Title: Re: IRC chat relay
Post by: Wolfbiter on February 11, 2007, 04:39:31 am
Ah.. thought you wanted clicky links at irc, not via irc.
Just change so it's "bla bla bla" (http:......) output, then it's easy to parse. But then there's the possible lowid/high id problem...
Title: Re: IRC chat relay
Post by: Nytridr on February 11, 2007, 06:34:01 pm
Ah.. thought you wanted clicky links at irc, not via irc.
Just change so it's "bla bla bla" (http:......) output, then it's easy to parse. But then there's the possible lowid/high id problem...

well with this and talking with Khalem I got this to work.. it dont look good on the IRC channel its self but we could care less with that.. but here it is..
this will allow all scripts and all linked items to be processed .. just basically took out the formating for it going to IRC..

Code: [Select]
/*
This gets called on a msg in the group
*/
function gmsg($name, $group, $msg)
{
$msg = str_replace("&gt;", ">", $msg);
$msg = str_replace("&lt;", "<", $msg);
if (($this -> irc != null) && ($this -> chat <= 1))
{
if (((strtolower($name) == strtolower($this -> bot -> botname)) && !empty($this -> relayguildname) &&
(preg_match("/^<font color=(.{6,7})>\[".$this -> relayguildname."\] (.*):(.*)$/", $msg))) ||
(strtolower($name) != strtolower($this -> bot -> botname)))
{
if ($this -> itemref == 0)
$rep = "http://auno.org/ao/db.php?id=\\1&ql=\\3";
else
$rep = "http://aomainframe.net/showitem.asp?LowID=\\1&HiID=\\2&QL=\\3";

//$msg = preg_replace("/<a href=\"itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\">(.*)<\/a>/iU", "\\4 (".$rep.")", $msg);

//$msg = preg_replace("/<a href=\"(.+)\">/isU", "[link]", $msg);
//$msg = preg_replace("/<\/a>/iU", "[/link]", $msg);
//$msg = preg_replace("/<font(.+)>/iU", "", $msg);
//$msg = preg_replace("/<\/font>/iU", "", $msg);

$this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, $this -> ircprefix . ' ' . $name . ': ' . $msg);
}
}
}



/*
This gets called on a msg in the privgroup without a command
*/
function privgroup($name, $msg)
{
$msg = str_replace("&gt;", ">", $msg);
$msg = str_replace("&lt;", "<", $msg);
if (($this -> irc != null) && ($this -> chat >= 1))
{
if (strtolower($name) != strtolower($this -> bot -> botname))
{
if ($this -> itemref == 0)
$rep = "http://auno.org/ao/db.php?id=\\1&ql=\\3";
else
$rep = "http://aomainframe.net/showitem.asp?LowID=\\1&HiID=\\2&QL=\\3";

//$msg = preg_replace("/<a href=\"itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\">(.*)<\/a>/iU", "\\4 (".$rep.")", $msg);

//$msg = preg_replace("/<a href=\"(.+)\">/isU", "[link]", $msg);
//$msg = preg_replace("/<\/a>/iU", "[/link]", $msg);
//$msg = preg_replace("/<font(.+)>/iU", "", $msg);
//$msg = preg_replace("/<\/font>/iU", "", $msg);

$this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, '[PGROUP] ' . $name . ': ' . $msg);
}
}
}



Code: [Select]
/*
* Gets called for an inc IRC message
*/
function irc_recieve(&$irc, &$data)
{
if ((strtolower($data -> message) != strtolower(str_replace("\\", "", $this -> bot -> commpre.'online'))) &&
(strtolower($data -> message) != strtolower(str_replace("\\", "", $this -> bot -> commpre.'is'))))
$msg = str_replace("", "", $data -> message);
$msg = str_replace("", "", $msg);

if ($this -> chat <= 1)
$this -> bot -> send_gc($this -> guildprefix . " <font color=#808000>" . $data -> nick . "</font>: " . $msg);
if ($this -> chat >= 1)
$this -> bot -> send_pgroup($this -> guildprefix . " <font color=#808000>" . $data -> nick . "</font>: " . $msg);


if (isset($this -> bot -> commands["gmsg"][$this -> bot -> guildname]["guildrelay"]))
{
$this -> bot -> commands["gmsg"][$this -> bot -> guildname]["guildrelay"] -> gmsg($this -> guildprefix .
" " . $data -> nick, "", $msg);
}
}

Not sure how correct this all is.. but it seems to work for now.. and I am deploying it accross all our bots and will be testing for any bugs in it..but with this this way.. it does NOT look good on IRC, but only 3 people actually have access to the IRC server since it is password protected and such.. so it isnt really a big deal..

Nytridr
Title: Re: IRC chat relay
Post by: Khalem on February 11, 2007, 08:07:40 pm
If your not using the IRC relay for much other than actual relaying between bots, there is nothing wrong with doing this :)
SimplePortal 2.3.7 © 2008-2024, SimplePortal