ok i was woundering how i would do this when some one types !music then the addy to have it open the file and write to it then have the music file play on the fly ? here is the bot im adding that to #!/usr/local/bin/perl print "Content-type: text/plain\n\n"; ######################## $owner = "LOKI-18"; $host = "spin.ath.cx"; $port = "6667"; $room = "spin"; $nick = "C0roNa"; $kicked = "off"; $copyed = "off"; use IO::Socket; $remote = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $port, Proto => "tcp"); lokbot("USER", $nick, $nick, $host, $nick); lokbot("NICK", $nick); lokbot("SETNAME LOW"); lokbot("NOTICE !C0roNa!"); lokbot("PRIVMSG $owner : Connected on $host $date"); lokbot("JOIN", "#$room", $pass); lokbot("PRIVMSG $owner :Joined #$room..."); $ALIVE = 1; while ( $ALIVE == 1 ) { &GET; if ($from eq $owner) { if ($msg =~ /!die/) { lokbot("PRIVMSG $owner :Signing: OFF... "); lokbot("QUIT", ":blah"); close($remote); $ALIVE = 0; } if ($msg =~ /!say/) { lokbot("PRIVMSG", "#$room", ":$say"); lokbot("PRIVMSG $owner :Message: Said."); } if ($msg =~ /!nick/) { lokbot("NICK $cnick"); lokbot("PRIVMSG $owner : Nick Change Attempted. "); } if ($msg =~ /!kick/) { lokbot("PRIVMSG $owner :kicking: $kick"); lokbot("KICK #$room $kick"); } if ($msg =~ /!join/) { lokbot("PRIVMSG $owner : joining: $join"); lokbot("JOIN $join"); } if ($msg =~ /!part/) { lokbot("PRIVMSG $owner :parting: $part"); lokbot("PART $part"); } if ($msg =~ /!op/) { lokbot("PRIVMSG $owner :Oping: $op"); lokbot("MODE #$room +o $op"); } if ($msg =~ /!deop/) { lokbot("PRIVMSG $owner :deoping:$deop"); lokbot("MODE #$room -o $deop"); } if ($msg =~ /!ban/) { lokbot("PRIVMSG $owner :Baning: $ban"); lokbot("MODE #$room +b $ban"); lokbot("KICK #$room $ban"); } if ($msg =~ /!unban/) { lokbot("PRIVMSG $owner :Unbaning $unban"); lokbot("MODE #$room -b $unban"); } if ($msg =~ /!mode/) { lokbot("PRIVMSG $owner :Mode is:$mode"); lokbot("MODE #$room $mode"); } if ($msg =~ /!quit/) { lokbot("PRIVMSG $owner :Quiting: $quit"); lokbot("QUIT :$quit"); } if ($msg =~ /!me/) { chop($me); chop($me); me("$me"); } if ($msg =~ /!con/) { lokbot("PRIVMSG $owner :copy:on"); $copyed = "on"; } if ($msg =~ /!coff/) { lokbot("PRIVMSG $owner :copy:off"); $copyed = "off"; } if ($msg =~ /!kon/) { lokbot("PRIVMSG $owner :KICK:on"); $kicked = "on"; } if ($msg =~ /!koff/) { lokbot("PRIVMSG $owner :KICK:off"); $kicked = "off"; } if ($msg =~ /!topic/) { lokbot("PRIVMSG $owner :topic is set"); lokbot("TOPIC #$room :$topic"); } } if ($msg =~ /!8ball/) { @ball = ("no", "yes", "Maybe", "Who knows?", "Never", "leave me alone", "only if u give me money", "i dont know", "who cares"); if ($quez =~ /Are you dumb?/) { $answer = "No"; } elsif ($quez =~ /are you dumb?/) { $answer = "No"; } elsif ($quez =~ /Are you a stupid?/) { $answer = "No"; } elsif ($quez =~ /are you stupid?/) { $answer = "No"; } elsif ($quez =~ /do i need a beer/) { $answer = "yes go get a beer now"; } elsif ($quez =~ /are u stupid/) { $answer = "No im not stupid"; } elsif ($quez =~ /sex/) { $answer = "sex damn i need some sex"; } else { $answ = int(rand(@ball)); $answer = $ball$answ; } lokbot("PRIVMSG", "#$room", ":$answer"); } if ($type =~ /NOTICE/) { $addpriv++; @bspyd = split(/ /, $msg); ($spymsg1, $spymsg2) = split(/:/, $msg,2); $spymsg =~ tr/ / /; if($spyed eq "on") { lokbot("PRIVMSG", "#$room", ":$spymsg2"); } } if ($type =~ /KICK/) { $addkick++; @bkicked = split(/ /, $msg); ($kickmsg1, $kickmsg2) = split(/:/, $msg,2); $kickmsg =~ tr/ / /; if($kicked eq "on") { lokbot("PRIVMSG", "#$room", ":››› $bkicked3 was kicked by $from ‹› $kickmsg2"); } } if ($msg =~ /!msg/) { @line = split(/ /,$allmsg); $to = $line[0]; $line[0] = ""; lokbot("PRIVMSG", "$to", ":@line"); lokbot("PRIVMSG $owner :Owner Notice: Message sent to $to"); } } if ($msg =~ /!mail/) { ($mto, $msub, $mmsg) = split(/&:/, $mail); if ($mto !~ /@/) { lokbot("PRIVMSG", "$owner", ":ADDY"); } if ($msub eq "") { lokbot("PRIVMSG", "#$room", ":Subject."); } if ($mmsg eq "") { lokbot("PRIVMSG", "#$room", ":Message."); } else { open(MAIL,"|$sendp -t"); print MAIL "Sender: $from\@$host\n"; print MAIL "To: $mto\n"; print MAIL "From: C0roNa\@$host\n"; print MAIL "Subject: $msub\n\n"; close(MAIL); lokbot("PRIVMSG", "#$room", ":Sending"); } } sub GET { recv($remote, $casio, 10000, 0); @casio = split(/:/, $casio); @info = split(/ /, $casio1); @usermask = split(/!/, $info[0]); $from = $usermask[0]; $mask = $usermask1; $type = $info1; $to = $info2; $msg = substr($casio, index($casio, ":")+1); $allmsg = substr($casio, index($casio, "!msg")+5); $say = substr($casio, index($casio, "!say")+5); $me = substr($casio, index($casio, "!me")+5); $what = substr($casio, index($casio, "me")+5); $op = substr($casio, index($casio, "!op")+4); $deop = substr($casio, index($casio, "!deop")+6); $ban = substr($casio, index($casio, "!ban")+5); $cnick = substr($casio, index($casio, "!nick")+6); $join = substr($casio, index($casio, "!join")+6); $part = substr($casio, index($casio, "!part")+6); $kick = substr($casio, index($casio, "!kick")+6); $mode = substr($casio, index($casio, "!mode")+6); $quit = substr($casio, index($casio, "!quit")+6); $quite = substr($casio, index($casio, "!qon")+6); $topic = substr($casio, index($casio, "!topic")+7); $unban = substr($casio, index($casio, "!unban")+7); if (substr($casio, 0, index($casio,":")) =~ /^PING/){ lokbot("PONG $server"); $server = substr($casio, index($casio, ":")+1, length($casio)); lokbot("PRIVMSG $to :PinG $server"); } } sub lokbot { $line = join(" ", @_); send($remote, "$line\015\012", 0); } sub me { $action = $_[0]; lokbot("PRIVMSG #$room :\001ACTION " .$action. "\001"); } sub cmd { $laction = $_[0]; lokbot("PRIVMSG $from :\001ACTION " .$laction. "\001"); } exit;

In reply to writeing user's input to the output file? by LOKI-18

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.