I'm basically just starting off, and trying to get the bot to send me a message after it's connected. This is my code, but it just.. doesn't work, for whatever reason.
$aim->start; starts an infinite loop of $aim->do_one_loop;, so it never returns and your $aim->send_im(...); is never called. Instead, you should run your own loop:
Code:
my $time = time + 10;<br />while( 1 )<br />{<br /> $aim->do_one_loop();<br /><br /> if( $time <= time )<br /> {<br /> $aim->send_im("MY USERNAME HERE", "I'm online");<br /> $time = time + 10;<br /> }<br />}
That should send a message every 10 seconds. I didn't test it, but it should give you the idea.
Net::AIM has a "config" handler, this handler is called after your bot signs on to AIM (and is most often used to set your bot's profile, for example).
Code:
$aim->set_handler ("config", \&on_config);<br /><br /># Start the bot<br />$aim->start();<br /><br /># The config handler<br />sub on_config {<br /> my $aim = shift;<br /><br /> # The bot is now connected and signed on.<br /> $aim->send_im ('botmaster', 'Hello!');<br /><br /> # You can also set the bots AIM profile here...<br /> $aim->set_info ("Hello, I am a Perl AIM bot!");<br />}
Is there any way to set up multiple bots through one perl script? Say I had two AIM accounts I wanted to log on and message me when they signed on? Or both sign on, then both message me?
hi.. i am researching a aim bot. i have never even dabbled in this sort of this before.
i just want to know if this is php code? does not look like it. i really want to make a bot in php. thanks. [right][snapback]46903[/snapback][/right]
It's Perl code. If you want PHP, try searching around Google for it... I personally don't know of one (there's an MSN one I know of though, Blobsy). _________________ Current Site (2008) http://www.cuvou.com/
how do you run perl code? i am very unaware of it.
It's Perl code. If you want PHP, try searching around Google for it... I personally don't know of one (there's an MSN one I know of though, Blobsy). [right][snapback]46904[/snapback][/right] [/quote]
[quote=qwertq,Mar 14 2005, 08:50 PM] how do you run perl code? i am very unaware of it.
It's Perl code. If you want PHP, try searching around Google for it... I personally don't know of one (there's an MSN one I know of though, Blobsy). [right][snapback]46904[/snapback][/right] [/quote] [right][snapback]46905[/snapback][/right] [/quote]
To run from your own computer: 1) Install ActivePerl ( http://www.activeperl.com/ ) 2) If you choose the installer package (MSI), it should claim the file extension .PL, and these files could then be double-clicked and executed just like a normal program.
To run from a remote host (webserver?): 1) Your host has to have Perl/CGI enabled. 2) If it has shell access, you can run your script from it through telnet 3) If not, you may need to make an additional CGI to start/stop your bot. _________________ Current Site (2008) http://www.cuvou.com/
ok let me check with my host and see about the shell access.
if i only want to send a message (not a full bot) using php would i not have to do all this?
To run from a remote host (webserver?): 1) Your host has to have Perl/CGI enabled. 2) If it has shell access, you can run your script from it through telnet 3) If not, you may need to make an additional CGI to start/stop your bot. [right][snapback]46912[/snapback][/right] [/quote]
ok let me check with my host and see about the shell access.
if i only want to send a message (not a full bot) using php would i not have to do all this?
It's not a good idea to make a bot to sign on and send a message and then sign off.
1) AIM has rate limits, and the rate limits apply to signing on and off too (not only about messages) 2) If, say, three or five or so people access your Send Message service in a row, your bot will be signing on and off so much that AIM's server will get mad and KEEP your bot offline for a good couple of hours.
So your best thing to do is to just make a full always-online bot, that reads messages from your server's CGI's and sends the messages out... not one that signs on, sends an IM, and signs out.
(To keep a bot online, you need to have a continuously running script in the background on your host) _________________ Current Site (2008) http://www.cuvou.com/