BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: exxie on February 28, 2007, 07:22:13 pm

Title: another Teamspeak module
Post by: exxie on February 28, 2007, 07:22:13 pm
hi there.

i know there's another teamspeak module* out there, but it only provides a list of all connected players on the server. so i made one which looks like the original teamspeak channel/user tree (see screenshot below). *works with php4 only

it supports multiple servers so you can add as many server as you like to.
you can specify a channel so that only this channel and its subchannels will be displayed.
you can access all servers via the server list or by handing over the server id with the command.
you can set a default server which will be displayed by default if you don't hand over a server id and of course you can add/remove all servers within the bot.

(http://img341.imageshack.us/img341/6968/ts2vt4.th.jpg) (http://img341.imageshack.us/my.php?image=ts2vt4.jpg)
Title: Re: another Teamspeak module
Post by: Ozball on March 01, 2007, 03:12:21 am
loaded the module but none of the commands seem to be working... I've got the access set to superadmin (me) in tells, but nothing is responding.

I had the other TS module loaded, but i overwrote the .php file with yours, dunno if i had to unload it in any way? (I restarted the bot after I overwrote)

Also small note: the help file is named teamspeak.txt so its showing up as !teamspeak in the !help listings (atleast i think thats why its showing up as that). !help !ts returns that it doesnt have a help file.
Title: Re: another Teamspeak module
Post by: exxie on March 01, 2007, 01:41:38 pm
loaded the module but none of the commands seem to be working... I've got the access set to superadmin (me) in tells, but nothing is responding.

I had the other TS module loaded, but i overwrote the .php file with yours, dunno if i had to unload it in any way? (I restarted the bot after I overwrote)

Also small note: the help file is named teamspeak.txt so its showing up as !teamspeak in the !help listings (atleast i think thats why its showing up as that). !help !ts returns that it doesnt have a help file.

mh, that's odd. do you have access to the bot's console? maybe you can see there what's the reason for not responding.

unloading a module is not necessary, a restart of the bot should be sufficient.

and if you want the bot to reply to '!help !ts' just make a copy of the file and/or rename it to 'Ts.txt'.
Title: Re: another Teamspeak module
Post by: Ozball on March 02, 2007, 03:54:23 am
the console wasnt showing anything, just the command showing up, not other output.

eg:

[TELL] [INC] Slynthia: !ts
[TELL] [INC] Slynthia: !ts list


nothing else shown.
Title: Re: another Teamspeak module
Post by: exxie on March 02, 2007, 03:18:27 pm
can't think of anything inside the code itself which could be a reason for such behaviour. must be something else ...

when the bot starts up, is there a '[MOD]   [LOAD]  Teamspeak.php' in the console without any error messages and is there a table named 'teamspeak' on the database with 6 colums named 'servername', 'channel', 'host', 'port', 'qport' and 'preset'?

Title: Re: another Teamspeak module
Post by: Snarfblatt on March 02, 2007, 06:04:19 pm
I have the exact same problem.. bot isn't responding to any of the !ts commands. The table is in the db and the columns are there.
Title: Re: another Teamspeak module
Post by: nebhyper on March 02, 2007, 06:22:27 pm
Here is your issue.

Code: [Select]
$ts = new Teamspeak($bot);

$commands["tell"]["ts"] = &$ts;
$commands["gc"]["ts"] = &$ts;
$commands["pgmsg"]["ts"] = &$ts;
$commands["tell"]["teamspeak"] = &$ts;
$commands["gc"]["teamspeak"] = &$ts;
$commands["pgmsg"]["teamspeak"] = &$ts;


/*
The Class itself...
*/
class Teamspeak {
var $bot;


/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Teamspeak (&$bot) {
$this -> bot = &$bot;
}


Change it to:

Code: [Select]

$ts = new ts($bot);

$commands["tell"]["ts"] = &$ts;
$commands["gc"]["ts"] = &$ts;
$commands["pgmsg"]["ts"] = &$ts;
$commands["tell"]["teamspeak"] = &$ts;
$commands["gc"]["teamspeak"] = &$ts;
$commands["pgmsg"]["teamspeak"] = &$ts;


/*
The Class itself...
*/
class ts {
var $bot;


/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function ts (&$bot)
            {
$this -> bot = &$bot;
$this -> bot -> ts = &$this;
}


You named it Teamspeak but you told the bot to look for ts and teamspeak in chat and direct it to class ts.  Hard for the bot to direct a command to a class that does not exsist. :)


I changed it all to ts, but you can change it to teamspeak so long as they all match.

Also I added:
Code: [Select]
$this -> bot -> ts = &$this;

This allows other modules to call up the functions in this module.  An example of why you would want this would be say you want to rewrite the alts display, whois display, or online display to show if someone is on teamspeak.

Example for Online: Siocuffin blah blah blah (Squad Commander) (SuperAdmin) (On teamspeak)


Title: Re: another Teamspeak module
Post by: exxie on March 02, 2007, 07:26:51 pm
aah, yes. my bad :/

i worked on the files directly on my server and uploaded an old copy from my harddrive and not the one from the server :)
that's why i said it couldn't be in the code itself since my bot worked without a flaw and the code looked good 8)

however i added the line nebhyper posted so the Teamspeak functions can be used in other modules.

links to the files updated.

... and thank you for the tip!
Title: Re: another Teamspeak module
Post by: nebhyper on March 02, 2007, 08:43:17 pm
You are more than welcome.  I made the same type of mistake on a module I wrote last night.  I copied and pasted from a template and forgot to change the class name.  I spent 30 minutes looking over teh code and rebooting the bot until I realized what I had done.  Only fair that I help out with the same problem here too.
Title: Re: another Teamspeak module
Post by: Ozball on March 02, 2007, 09:13:02 pm
Redownloade the from the link in the first post, still not getting any response from commands... Is the commands !ts or !teamspeak? neither work, just wanted to check, since the help file says !ts but unless im reading the code wrong the code is set up for !teamspeak?
Title: Re: another Teamspeak module
Post by: nebhyper on March 02, 2007, 09:23:13 pm
according to the code it is looking for:

!ts add <info>
!ts del <info>
!ts default <info>
!ts list
!ts <ID>

!teamspeak is code to be looked for by the bot and to be directed to this module and class, however tell, gc, and pgroup of this module are not looking for teamspeak. (Just need to copy the code for each and replace ts with teamspeak.)

as for !ts doing anything, I do not think it will based on the code, unless you first set the default teamspeak id.  If defualt is not set !ts will not work.  if defualt has been set !ts will work.

Even with no defualt you should atleast get this message;
"No default server set. Please specify a server number or set a default server."
Title: Re: another Teamspeak module
Post by: Ozball on March 02, 2007, 09:38:33 pm
tried:
!ts add <serverinfo>
!ts list
!ts
!ts default 1
!ts 1

nothing had any kind of response from the bot(looking at the console there was nothing there either)

Oh also what format is the address in? would !ts add blah.blahblah.com:8767 work?
Title: Re: another Teamspeak module
Post by: exxie on March 02, 2007, 10:44:57 pm
cleaned the file from obsolete code and updated the links on my 1st post.

the only working command should be 'ts' not 'teamspeak'. i just copied the file from the server to my desktop und uploaded it from there. that should avoid all wrong version uploads :)

when testing the bot with the module i get the following response:

To [Battlecom]: ts list
Battlecom: 4 servers on list. :: click to view
To [Battlecom]: ts default 5
Battlecom: Server #5 has been set as the default server.
To [Battlecom]: ts
Battlecom: 0 members on Teamspeak. :: click to view
To [Battlecom]: ts 7
Battlecom: 61 members on Teamspeak. :: click to view


works just fine :-/

Quote
Oh also what format is the address in? would !ts add blah.blahblah.com:8767 work?

nope. format has to be '<host> <port> <qport> <channel>(optional)'. e.g.: !ts add blah.blahblah.com 8767 51234
51234 is the standard query-port. servers may use another (secret) query-port so that people who don't know it can't get the serverinfo from the outside. thus you have to specifiy both ports.
Title: Re: another Teamspeak module
Post by: nebhyper on March 03, 2007, 12:58:29 am
@Ozball:

It sounds like the module is not loading.  When you start the bot at in console it shows every module it loaded, check for this one.
Title: Re: another Teamspeak module
Post by: Ozball on March 03, 2007, 01:27:47 am
Still doesnt want to work :S

I'll give it a try on one of the hardcoded superadmins abit later. I wonder if its not liking the character im using, who's (according to FCs DB) still not in the org, but is set as a superadmin (and admin) and can do the other commands fine (but needs to be added to the guest list with !guest).
Title: Re: another Teamspeak module
Post by: mookie on March 03, 2007, 08:09:49 am
Anyone get this Module to work? This command !ts is not working on 0.3.3 / v5 php.
Title: Re: another Teamspeak module
Post by: exxie on March 03, 2007, 02:03:03 pm
don't know if it's working with version 0.3.x of bebot but this is a bebot 0.2.x module therefore i posted it in the 0.2.x Custom/Unofficial Modules section :)
also i'm running php4 on my server so i don't have tested it with php5.
Title: Re: another Teamspeak module
Post by: Ozball on March 04, 2007, 01:01:27 am
for the record im using 0.2.11 and php5 i think(which ever PHP comes in the files on the front page with 0.2.11)
Title: Re: another Teamspeak module
Post by: exxie on March 04, 2007, 02:43:48 pm
i will test it with bebot 0.3.x and php5 and get back to you with the results as soon as i have the time fo it.
Title: Re: another Teamspeak module
Post by: exxie on March 06, 2007, 10:24:35 pm
because there's no way to get bebot running with php5 under windows and i don't get php5-cgi to work with bebot on my linux-server, i can't test it with php5. sorry guys :-(
Title: Re: another Teamspeak module
Post by: mookie on March 08, 2007, 03:25:11 am
ok, guess they We should ingnore http://svn.shadow-realm.org/index.py/BeBot/branches/BeBot-php/
and windows Php ports.
Sorry to say, PHP is easy to run on windows.

good work otherwise. I will have to play around with your code some more. I am sure its some class reference. Did you modify anything in Bot.php?

Title: Re: another Teamspeak module
Post by: Ozball on March 08, 2007, 06:31:37 am
I just unzipped the files from the php bundle link on the home page of this site, into the root dir of my bot and that was all the php i needed. I run Win XP Pro.
Title: Re: another Teamspeak module
Post by: Khalem on March 10, 2007, 12:07:34 am
because there's no way to get bebot running with php5 under windows and i don't get php5-cgi to work with bebot on my linux-server, i can't test it with php5. sorry guys :-(

Since when? BeBot is currently ONLY tested with php5 on windows. The current php bundle for BeBot is PHP 5.2.1
Title: Re: another Teamspeak module
Post by: exxie on March 16, 2007, 02:28:42 pm
Since when? BeBot is currently ONLY tested with php5 on windows. The current php bundle for BeBot is PHP 5.2.1

i get the error message

[LOGIN] [STATUS]        Authenticateing
AOChat: not expecting authentication.


everytime i start the bot.

i tried every tip written in the forums to get rid of this error but none of them worked. Xenixa wrote in this thread here (http://bebot.link/index.php/topic,299.0.html) to use php4. but that's obviously not what i want :-/
Title: Re: another Teamspeak module
Post by: Vhab on March 16, 2007, 06:55:55 pm
Which version of php5, which version of bebot, which cpu platform?
Title: Re: another Teamspeak module
Post by: exxie on March 20, 2007, 03:00:03 pm
Which version of php5, which version of bebot, which cpu platform?

sorry for my late response :-/

here you go:

php: 5.4.1 (the version from the bebot 0.3.3 release thread)
bebot: 0.3.3 (see above)
cpu/os: amd, windows xp pro

i'm using the aokex.dll for windows as stated here (http://bebot.link/index.php/topic,274.0.html) and tried AOChat.php version 1.19 from Auno's website, the one which came with bebot 0.3.3, as well as Xenixa's modified 1.17. none of them worked, i always get the same error with all versions.
Title: Re: another Teamspeak module
Post by: exxie on March 29, 2007, 04:47:19 pm
mh ... i used a remote mysql-database when i started the bot. when i use my local database (on the same machine as the bot) there's no error message. strange ...
Title: Re: another Teamspeak module
Post by: exxie on March 30, 2007, 09:03:43 pm
Code: [Select]
$Teamspeak = new Teamspeak($bot);

$commands["tell"]["ts"] = &$Teamspeak;
$commands["gc"]["ts"] = &$Teamspeak;
$commands["pgmsg"]["ts"] = &$Teamspeak;

class Teamspeak {
var $bot;

/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Teamspeak (&$bot) {
$this -> bot = &$bot;
$this -> bot -> Teamspeak = &$this;
}

/*
This gets called on a tell with the command
*/
function tell($name, $msg) {
if (preg_match("/^" . $this -> bot -> commpre . "ts add (.+)/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> add_tsserver($name, $info[1]));
elseif (preg_match("/^" . $this -> bot -> commpre . "ts del ([0-9]+)/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> del_tsserver($name, $info[1]));
elseif (preg_match("/^" . $this -> bot -> commpre . "ts default ([0-9]+)/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> set_tsserver($name, $info[1]));
elseif (preg_match("/^" . $this -> bot -> commpre . "ts list/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> list_tsserver($name));
elseif (preg_match("/^" . $this -> bot -> commpre . "ts(?: *)([0-9]*)/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> show_tsstatus($info[1]));
}

        /*
          ...
        */
}

testing the module with full error_reporting i get these messages:

Notice: Trying to get property of non-object in Teamspeak.php on line 57
Notice: Trying to get property of non-object in Teamspeak.php on line 59
Notice: Trying to get property of non-object in Teamspeak.php on line 61
Notice: Trying to get property of non-object in Teamspeak.php on line 63
Notice: Trying to get property of non-object in Teamspeak.php on line 65
Fatal error: Call to a member function send_tell() on a non-object in Teamspeak.php on line 66

the lines 57, 59, 61, 63, 65 are the ones with $this -> bot -> commpre . ... and line 66 ist the line with $this -> bot -> send_tell().
seems that the script cannot access the bot-object and its methods but i don't know why. according to google it's a problem with the new php5 object model and ppl recommend to use php4 instead ...

any ideas?
SimplePortal 2.3.7 © 2008-2024, SimplePortal