Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

im bot text responses

by Anonymous Monk
on Jun 10, 2002 at 22:42 UTC ( #173330=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hey i'm at the very beginning of perl and making a simple im bot. i downloaded the beginner bot from, and its cool. my main purpose thus far is to make text responses to input from people im, so say my friend im's the bot, and then input would be what they say [or part of it, wired bots had a simple code
Screenname: SCREENNAME;
Password: PASSWORD;
Hello|Hi|Hey=exact>Hi! How are you?|Hello!;
Are you=>Yep.|Probably.|I dunno.|Nah.;
my problem was the 'are you=>yep.|probably.|i dunno.|nah.;' section doesnt work. when i tested and said "how are you", the response i get is "huh?" how would i include these inputs and responses into my bot?

hey,-------------------hey, hello, or hi.
whats up, sup, etc,----not much, but this is andys im bot
please respond soon, it would be much appreciated, and if i begin to grasp this stuff i may enter the business one day. also please email the response to


2002-06-11 Edit by Corion : Changed a single opening bracket ([) to it's HTML entity [ - maybe this helps unbreak the node.

Replies are listed 'Best First'.
Re: im bot text responses
by DamnDirtyApe (Curate) on Jun 10, 2002 at 22:47 UTC
    What does your code look like so far? Without an example of exactly what it is that's not working, it's near impossible to help you fix it. :-)
    D a m n D i r t y A p e
    Home Node | Email
Re: im bot text responses
by newrisedesigns (Curate) on Jun 11, 2002 at 18:51 UTC

    Just a really out there suggestion...

    Instead of just downloading software that's intended to teach *cough*scriptkiddie*cough*, you should learn Perl to make your bot far more functional than the template will allow.

    Learning Perl will allow you to create innovative features, and your knowledge of the language will help you in other ways.

    Try learning Perl. I (and many other perl monks) would be more than willing to help you if you had a problem with code you had written. But Perl Monks isn't tech support for cut-and-paste outside code.

    Learn Perl. It's good for you.

    from the tutorial: I would recommend learning Perl if you want to make a good bot. There are some great sources to help you learn Perl, such as and

    John J Reiser

Re: im bot text responses
by Anonymous Monk on Jun 11, 2002 at 15:23 UTC
    sorry for not including more code, i'll put that in now
    the code given by (the one that only has 1 line work, that i cant figure out) was given and is:


    Screenname: SCREENNAME;
    Password: PASSWORD;
    Hello|Hi|Hey=exact>Hi! How are you?|Hello!;
    Are you=>Yep.|Probably.|I dunno.|Nah.;


    now the main perl one that i would want to enter the responses into is called, and it shows and area to enter the responses (if not a command), but i dont know what to put in or how. heres that code

    # on_im();
    # desc: This sub is called when the bot recieves an IM.
    # It first grabs AIM default vars.
    # Then filters those vars
    # Then checks to see if $victim is an idiot
    # Then Checks to see if $msg is a command
    # If not a command && not an idiot:
    # It replies via the custom code (or command sub)
    # Then logs the IM
    # Then sleeps and sends
    # recv: AIM's vars w/ $victim, $friend, and $msg as args.
    # sends: either a warning, or a message.

    sub on_im {

    ($aim, $evt, $from, $to) = @_;
    $args = $evt->args();
    ($victim, $friend, $msg) = @$args;

    #filter $victim, make it lower case and remove spaces
    $victim = lc($victim);
    $victim =~ s/ //g;

    # This Code creates formats $msg the way you (should) want it, without HTML.
    $msg =~ s/<(.|\n)+?>//g;

    #check against IDIOT LIST
    my $idiot = idiots("$victim");

    #if an idiot, warn and block him
    if ($idiot != 1) {
    #otherwise, continue

    #check msg vs. list of commands.. call the commands sub
    ($isacommand,$reply) = commands($victim,$msg);

    #if not a command..
    if ($isacommand != 1) {
    #custom code
    #put what you want your bot to do here.
    #its better to put it in a sub, so you can edit it later
    #right now its set up to grab a thought from my database
    $reply = thought();

    #end custom code

    #LOG this IM..


    #SLEEP & SEND!
    $aim->send_im($victim, "$reply");
    #print that the sleep is done..
    print " done.\n\n";



    now it also says i could put it in a sub file, so that it would be easier to edit. if i were to, how would i do this?

    thanks alot for your help and please respond and email responses to

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://173330]
Approved by rob_au
[Discipulus]: karl you says the same of my mom: in your place I'd been
[Discipulus]: preoccupied.. ;=)
Discipulus stopped with turkisk spices anyway.. but better hashes than arrays!
[oiskuu]: Discipulus, from the edge or from the top?
[Discipulus]: oiskuu from the top aka 0-0 coords
[LanX]: edge or node?
[oiskuu]: from each height difference, there's a fixed number of "moves right" - "moves left". So it's a number of combinations.
[Discipulus]: I already know how much distinct paths exists but to demonstrate the property i want to have them all

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2018-03-19 11:01 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.