#!/usr/bin/tclsh if {[catch { set destination {} set source {} foreach {destination source} $argv break if {![llength $source]} { set source Tester } if {![llength $destination]} { set destination {#test} } package require irc # ::irc::config logger 1 # ::irc::config debug 1 set msg [read stdin] # Strip the header from the message (assuming an email-formatted message) regsub {^([^\n]+\n)*\n} $msg {} msg # Remove newlines from the message regsub -all {\n+} $msg { } msg after 60000 {exit 0} set i [::irc::connection] $i registerevent EOF {set ::exit 1} # Replace 'localhost 6667' with your IRC host and port $i connect localhost 6667 $i nick $source # Servers usually ignore arguments 2 and 3. $i user $source localhost localhost {send-irc bot} $i registerevent 251 { set ::ready 1 } vwait ready if {[regexp {^#} $destination]} { $i join $destination } $i privmsg $destination $msg $i quit Bye! vwait exit exit 0 }]} { puts stderr $::errorInfo exit 1 }