I've seen something like this in many scripts, although I've been unable to extract it from them. Basically, I want a script that when a command is called (.report) in a channel, it will add all the text to a new line in a file and then tell the user that it's done. I use something else for this that allows users to report problems with the bot, but this method would be much better.
So, I want it to:
Create the file for the reports
When the command is initiated, it will create a new line in the file with: Nickname reported: report here
Then tell the user Thanks for reporting!
set report(file) "scripts/report.txt"
set report(thanks) "thanks for the report:)"
set report(owner) "" ;# set one nick to message, telling of the new report ("" = message off) #
bind pub -|- .report report:tofile
proc report:tofile {nk uh hn ch tx} {
set open [open $report(file) a]
puts $open "$nk reported: $tx"
close $open
puthelp "PRIVMSG $ch :${nk}: $report(thanks)."
if {$report(owner) ne "" && [onchan $report(owner)]} {
puthelp "PRIVMSG $report(owner) :$nk submitted a report."
}
}