Din start se observa ca in lipseste o "}" la sfarsit, cea care inchide procesul.
Second, ultimul if: ai pus conditie, ai deschis si nu ai facut nimic

Anyway, eroare iti da de la ultima acolada, asa ca pune-o si vezi
Code:
setudef flag trivia
bind join - * trivia
proc trivia {nick uhost hand chan text} {
global botnick tgchan trivia
if {($text == "") || ([regexp -nocase "all" $text]) || ([regexp -nocase "Resident" $text])} {
if {(([lsearch -exact [string tolower $tgchan] [string tolower $chan]] != -1) || ($tgchan == "*"))} {
if {[string match "*+trivia*" [channel info $chan]]} {
}
}
}
}