Hi all!
I need a tcl script to append, by a trigger, an url from irc to a text file, and with another it read the text file and write the output in the client query. Does it is possible?
p.s.
sorry for my english
Code: Select all
bind pub - !url saveurl
proc saveurl {nick uhost hand chan arg} {
if {$arg == ""} {
puthelp "PRIVMSG $chan : Usage is !url web_page_url"
} else {
set fname "urlsave.txt"
set fp [open $fname "a"]
puts $fp $arg
close $fp
}
}
bind pub - !listurl listurl
proc listurl {nick uhost hand chan arg} {
set fp [open "urlsave.txt" "r"]
set data [read -nonewline $fp]
set lines [split $data "\n"]
close $fp
foreach x $lines {
puthelp "PRIVMSG $nick :$x"
}
}