insult.tcl 516 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/tcl
  2. #
  3. # insult script, connects to insulthost.colorado.edu:1695
  4. # and gets an insult
  5. #
  6. #
  7. # set hostname or IP and port:
  8. proc pub_insult { nick host hand chan arg } {
  9. set insulthost "insulthost.colorado.edu"
  10. set insultport "1695"
  11. set insultnick [lindex $arg 0]
  12. # open socket, get insult message, close socket and
  13. # output the message::
  14. set s [socket -async $insulthost $insultport]
  15. set insult [gets $s]
  16. puthelp "PRIVMSG $chan :$insultnick: $insult"
  17. #after 500
  18. close $s
  19. }
  20. bind pub - !insult pub_insult