User Control Panel
Advertisements

HELP US, HELP YOU!

Trying to get a bot to send a message

 
Post new topic   Reply to topic    Bot Depot Forum Index -> AIM Protocol & questions
View unanswered posts
Author Message
FirebirdGM
Newbie
Newbie


Joined: 13 Mar 2005
Posts: 2

Reputation: 14

PostPosted: Sun Mar 13, 2005 9:05 pm    Post subject: Reply with quote

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.

Code:
<br />$screenname = "Botusername";<br />$password = "botpassword";<br /><br />use File::Basename;<br />chdir(dirname($0));<br /><br />use Net::AIM;<br />use LWP::Simple;<br /><br />my $aim = new Net::AIM;<br /><br />$aim->newconn( Screenname => $screenname,<br />               Password   => $password )<br />                or die "Error: Cannot connect to the AIM server!";<br /><br />$conn = $aim->getconn();<br /><br />print "\nBot loaded successfully!\n\n";<br /><br /><br />$aim->start;<br /><br />$aim->send_im("MY USERNAME HERE", "I'm online");<br />


The values are all correct [Usernames/passwords/Botusername].

Ideas?
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Sun Mar 13, 2005 10:16 pm    Post subject: Reply with quote

$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.
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Mon Mar 14, 2005 12:38 am    Post subject: Reply with quote

Very good way to start off by the way....Build on it while learning....
Others should take notice and take suit...
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Mon Mar 14, 2005 12:42 am    Post subject: Reply with quote

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 />}

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
FirebirdGM
Newbie
Newbie


Joined: 13 Mar 2005
Posts: 2

Reputation: 14

PostPosted: Mon Mar 14, 2005 3:24 am    Post subject: Reply with quote

Ahh, that worked perfectly -- Thanks.

One other question.

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?
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Mon Mar 14, 2005 9:19 am    Post subject: Reply with quote

What does File::Basename; do?
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Mon Mar 14, 2005 9:56 am    Post subject: Reply with quote

How about looking it up yourself??

Don't they teach people how to learn on their own anymore?
Back to top
qwertq
Newbie
Newbie


Joined: 14 Mar 2005
Posts: 3

Reputation: 14

PostPosted: Mon Mar 14, 2005 10:55 pm    Post subject: Reply with quote

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.
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Mon Mar 14, 2005 11:07 pm    Post subject: Reply with quote

QUOTE(qwertq @ Mar 14 2005, 05:55 PM)
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/
Back to top
qwertq
Newbie
Newbie


Joined: 14 Mar 2005
Posts: 3

Reputation: 14

PostPosted: Tue Mar 15, 2005 1:50 am    Post subject: Reply with quote

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]
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Tue Mar 15, 2005 12:49 pm    Post subject: Reply with 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/
Back to top
qwertq
Newbie
Newbie


Joined: 14 Mar 2005
Posts: 3

Reputation: 14

PostPosted: Tue Mar 15, 2005 2:22 pm    Post subject: Reply with 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?


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]
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Tue Mar 15, 2005 7:48 pm    Post subject: Reply with quote

QUOTE(qwertq @ Mar 15 2005, 09:22 AM)
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/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> AIM Protocol & questions All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group