BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => BeBot Hyborian modules => Topic started by: URFUBAR on July 17, 2008, 09:12:55 am

Title: Web GuildChat Module
Post by: URFUBAR on July 17, 2008, 09:12:55 am
Wrote a simple module last night that allows you to access guild chat from any web browser. It works like this:

From within the game you must first register and set yourself a webchat password using:

Code: [Select]
/tell bot !webchat register mypass
once you've done this you can login to the webchat php page using your player usename and webchat password.

Other in game commands include:

Code: [Select]
/tell bot !webchat to list all the webchat registered users (color coded based on whether they are logged into webchat or blocked access).

Code: [Select]
/tell bot !webchat block playername
/tell bot !webchat allow playername

Thats it really.

Obviously the webchat sends all its messages as the bot user and therefore in-game chat sessions will look like this.

[Guild][Bot][Bob]Hi there, Bob here on webchat from work
[Guild][Bill]Hi Bob I'm at home playing!
[Guild][Tom]Hi Bob, some PVP later?
[Guild][Bot][Bob]Sounds good, I'll be logging in aroudn 5pm
[Guild][Bot][Fred]Count me in too!

anyway thats it, will post up the code later just in case anyone is interested. It's not perfect, and I still need to add code so that chat hyperlinks work as per in the game (items links won't work though).

Can't upload the module from work but I've attached a screenshot until I can do the upload later this evening.
Title: Re: Web GuildChat Module
Post by: CheRny on July 17, 2008, 09:28:36 am
Great! I am using Bebot IRC relay which is an official module in the bot, but I'll be great to test your module too. But if I wanna test it at least you need to post your module php here :)
Title: Re: Web GuildChat Module
Post by: URFUBAR on July 17, 2008, 11:30:58 am
But if I wanna test it at least you need to post your module php here :)
lol will do, just in work at the moment and won't be able to upload until this evening.
Title: Re: Web GuildChat Module
Post by: Organizer on July 17, 2008, 11:33:55 am
Sound cool, but I presume this only works if the webchat is running on the same machine that the bot is running on? In my case my own pc for the bot and if we would like to use this it would have to be our our external webhost..
Title: Re: Web GuildChat Module
Post by: URFUBAR on July 17, 2008, 11:41:16 am
Sound cool, but I presume this only works if the webchat is running on the same machine that the bot is running on?

yes, it's a bit basic (only a couple of hours work) and simply tails (and parses) the bebot output file to get messages from guildchat. To send messages in, the web script simply writes to a database which the webchat bot module checks every couple of seconds. If it finds anything it prepends the sender to the message and then sends it to the guild chat channel.

I suppose we could redirect bebot output to a php script which in turn writes to a database. But you'd obviously have to open a hole in your firewall at home to allow mysql requests to come in from the net.

Will add this functionality if its required, sounds pretty straightforward.

Also by adding some access controls to webchat, users could perform remote web admin of bebot using the same interface. This could be useful.

Title: Re: Web GuildChat Module
Post by: Vrykolas on July 17, 2008, 01:45:39 pm
rather than redirecting the output you could write a module that parses guild chat as the bot recieves it and checks the web chat every so often....
kind of like this
Code: [Select]
$web_chat = new web_chat(&$bot);

/*
The Class itself...
*/
class web_chat Extends BaseActiveModule
{
var $bot;


/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function __construct (&$bot)
{
parent::__construct(&$bot, get_class($this));
$this -> register_event('gmsg', 'org');
$this -> register_event('cron', '2sec');

$this -> help['description'] = "Passes guild chat to the web chat and back.";
}

function command_handler($name, $msg, $origin)
{
$this->error->reset(); //Reset the error message so we don't trigger the handler by old error messages.
return;
}

function gmsg($name, $group, $msg)
{
// Code to pass guild chat to web chat here
}

function cron()
{
// Code to pass web chat to guild chat here
}
}
Title: Re: Web GuildChat Module
Post by: Temar on July 17, 2008, 02:21:43 pm


I suppose we could redirect bebot output to a php script which in turn writes to a database. But you'd obviously have to open a hole in your firewall at home to allow mysql requests to come in from the net.


you could have the bot use an address on a remote sever to pass messages on like..
Code: [Select]
$address = "http://www.mywebserver.com/add.php?name=gamename&msg=hi!";
BTW i also have a Webchat Module i call AOWC, mine can do simple guild chat aswell as full login and chat
Title: Re: Web GuildChat Module
Post by: URFUBAR on July 17, 2008, 02:36:22 pm
BTW i also have a Webchat Module i call AOWC, mine can do simple guild chat aswell as full login and chat
lol that would have saved me the effort. Is it available for download?
Title: Re: Web GuildChat Module
Post by: URFUBAR on July 17, 2008, 02:39:26 pm
rather than redirecting the output you could write a module that parses guild chat as the bot recieves it and checks the web chat every so often....
kind of like this

wow, should have read the manual or at least looked at the parent class code!

many thanks!
Title: Re: Web GuildChat Module
Post by: Temar on July 17, 2008, 03:45:57 pm
http://svn.aofiles.com/svn/AOWC_Lite/

put AOWC.php from /bot/ in the bot module folder

the Rest go in the webserver

this currently designed to work with SMF or PHPBB
it uses user detail from those, i plan on writeing a 3rd option of an intneral login so those forums arnt required but not done yet.

use the prefs.sql file to add the required table

Sorry i havnt bothered with a good Install file yet :p
Title: Re: Web GuildChat Module
Post by: Vain on July 19, 2008, 09:51:51 am
But if I wanna test it at least you need to post your module php here :)
lol will do, just in work at the moment and won't be able to upload until this evening.

Any progress?
I would love to use this.  ;D
Title: Re: Web GuildChat Module
Post by: Temar on July 19, 2008, 06:36:11 pm
working on an install file. Will make official release of aowc later today
Title: Re: Web GuildChat Module
Post by: elvyne on July 22, 2008, 01:10:13 am
what webserver program do you recommend running this on =/ I dont understand apache that well so yeah. Btw any luck on the installer?
Title: Re: Web GuildChat Module
Post by: Temar on July 22, 2008, 01:46:43 am
installer is done and AOWC has been released, ill be releaseing 1.5 with in the hour

http://bebot.link/0-5-x-customunofficial-modules/aowc/
Title: Re: Web GuildChat Module
Post by: krillin on July 22, 2008, 09:14:12 am
To bad that i'm using none of the mentioned forums :(
Title: Re: Web GuildChat Module
Post by: Temar on July 22, 2008, 03:32:27 pm
i will have internal user management in alater release, prob within a week
Title: Re: Web GuildChat Module
Post by: Foxy on July 22, 2008, 07:21:32 pm
does the Webserver need to be in the same place of where the bot is located?

e.g. I run my site on a external web server but the bot i run on my mini itx pc in my pc case.

does the website need to use same sql as the bot.
Title: Re: Web GuildChat Module
Post by: Temar on July 22, 2008, 08:35:19 pm
currently yes, i will be doing seperate connect details prob in 1.6
Title: Re: Web GuildChat Module
Post by: elvyne on July 23, 2008, 01:27:13 am
So i should set up my own webserver.  Do you have any recommendations of wich one? Like wich are you using?
Title: Re: Web GuildChat Module
Post by: Temar on July 23, 2008, 02:12:16 am
i use lycos

http://partnershop.lycos.co.uk/shop/1191/

i use a VDS so i can do anything
i got Bots, Teamspeak, Forums,  Websites

altho u need some experiance in Linux for VDS but they have other stuff too that dont

Title: Re: Web GuildChat Module
Post by: elvyne on July 23, 2008, 07:18:24 pm
hmm, bit annoying, considering the php files have to be on the lycos server thing, however if i understand you right, both the webserver as the bot need to be on the same pc? Thus a own pc webserver would be required? or am i mistaking here?
Title: Re: Web GuildChat Module
Post by: Temar on July 23, 2008, 07:40:55 pm
PHPBB should work fine with bot on dif server, if u put user prefs on dif server too, as with PHPBB it doesnt access PHPBB tables
Only SMF Requires this

I plan on Making Changes to Allow you to have Dif server with SMF too soon
Title: Re: Web GuildChat Module
Post by: elvyne on July 24, 2008, 03:36:01 am
I think ive lost you know. Anyway you could write a readme to set this thing up on lycos with phpbb or something =/
Title: Re: Web GuildChat Module
Post by: Serbaa on March 04, 2009, 04:51:49 am
any update on this?
Title: Re: Web GuildChat Module
Post by: Temar on March 04, 2009, 05:59:40 pm
http://www.twc-bebot.co.uk
Title: Re: Web GuildChat Module
Post by: Margon on August 28, 2009, 08:24:37 am
this script doesn't work with the actually bebot or php (5) version.
Title: Re: Web GuildChat Module
Post by: Temar on August 28, 2009, 12:39:57 pm
it woks fine, i use php 5
and bebot ofc
and btw the current site address is http://twc.aofiles.com
i dont know how to get twc-bebot.co.uk transfered
the previous host was lycos who stopped hosting
Title: Re: Web GuildChat Module
Post by: Margon on August 30, 2009, 05:10:40 pm
i got a lot php errors, do i realy need one of the 3 forumtypes to run this modul?

(i use woltlab wbb3)
Title: Re: Web GuildChat Module
Post by: Temar on August 30, 2009, 06:52:16 pm
the option for running this are
smf forum
phpbb3
twc - as in no forum, work alone login
Title: Re: Web GuildChat Module
Post by: Margon on August 30, 2009, 10:41:37 pm

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /var/www/twc/sql.php on line 112

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/twc/sql.php on line 123

Access denied for user 'root'@'localhost' (using password: YES)

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/twc/sql.php:112) in /var/www/twc/index.php on line 222

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/twc/sql.php:112) in /var/www/twc/index.php on line 222

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/twc/sql.php on line 123

Access denied for user 'root'@'localhost' (using password: YES)

    * Making user_prefs Table...CREATE command denied to user ''@'localhost' for table 'user_prefs'
    * Checking user_prefs Table... TABLE not Found
    * Making settings Table...CREATE command denied to user ''@'localhost' for table 'settings'
    * Checking settings Table... TABLE not Found
    * Not adding Settings as Previous Step Failed
      Making users Table...CREATE command denied to user ''@'localhost' for table 'users'Done
    * Checking users Table... TABLE not Found
    * Checking bot message Table...

      SELECT command denied to user ''@'localhost' for table 'settings'
    * Updateing settings file...



Install Complete v2.2 Beta r27

:(
SimplePortal 2.3.7 © 2008-2024, SimplePortal