View ¡m../sdba/commands/sendim.pl¡n
################################ # WIRED BOTS # # sendim($victim‚$msg); # # desc: This sub tells the bot to send an IM to a specific user. # For this, $msg should be formatted as "/sendim screenname->what"; # It grabs # recv: $victim‚$msg # sends: $reply, an IM. ################################ sub sendim { #Is this an admin-only command? (1 for yes, 0 for no). $adminonly = 1; #Get the admin's screenname. open (FILE, "admin.txt"); $admin =
; close(FILE); #Get the message and the victim. $victim = shift; $msg = shift; #Make a new variable to work with containing the message. $message = $msg; #Take the prefix off of the message. $message =~ s/\/sendim //ig; #Split the message ($sn,$what) = split(/->/,$message); #If the message is in an improper format... if ($sn eq "" || $what eq "") { #Tell them. $reply = "Your command was in an improper format. The proper format is:" . " /sendim username->message to send"; } #If the command is admin-only and the victim is not the admin... elsif($adminonly == 1 && $victim ne "$admin") { #Return an error message. $reply = "Sorry, This is an Admin-only command."; #Otherwise, continue. } else { #Send the IM. $aim->send_im($sn, "$what"); #Return the confirmation message. $reply = "Message sent!"; } #Return the reply. return $reply; } 1;