Hello ladies and gentlemen, today I come to you to request a public note script.
It should use channel commands (well, only one command -> .note $nick $text) and tell $nick the note as soon as he either joins the channel or says something.
The only note scripts I have found either use the partyline or a query-based system.
I'd like the output to be something like "$nick: $othernick left a note $time ago: $text" where $nick is the target and $othernick is the one who left the note. (for example: "SignZ: randomguy left a note 1 hour, 52 minutes ago: this is a note")
I hope you guys can help me with this request.
package require sqlite3
sqlite3 notesdb pubnotes.db
notesdb eval {CREATE TABLE IF NOT EXISTS notes (from TEXT, time INTEGER, to TEXT, message TEXT}
bind pub - .note pub_note
bind join - pub_note_join
bind pubm - pub_note_bind
proc pub_note {n u h c a} {
set m [join [lassign [split $a] t]]
set time [clock seconds]
notesdb eval {INSERT INTO notes VALUES ($n, $time, $t, $m)}
putnotc $n "Note was send."
}
proc pub_note_check {n c} {
set notes [channel get $c notes]
notesdb eval {SELECT * FROM notes WHERE to = $n} {
putmsg $c "$to: $from left a note [duration [expr {[clock seconds] - $time}]] ago: $message"
}
notesdb eval {DELETE FROM notes WHERE to = $n}
}
proc pub_note_bind {n u h c args} {pub_note_check $n $c}