· 6 years ago · Jan 19, 2020, 07:06 PM
1# IRC Karma for Eggdrops by Lily (lily@disorg.net)
2# This is a Karma database script for Eggdrop bots.
3# It has flood control built in, and basic self-karma prevention.
4# Requires TCL8.4 or greater, and the sqlite3 tcl lib. (not mysql!)
5# For deb/ubuntu, that is the libsqlite3-tcl package. Adjust for your flavor.
6# !! 3.x USERS PLEASE NOTE!!! The database change for 4.x means that unless
7# you manually edit your db, you will have to start over. Sorry! You may not want
8# karma entropy and expiry anyway, and thats the big new feature here.
9# 1.0 - self karma prevention
10# 2.0 - flood control, maries mods added
11# 2.5 - command triggers fixed, extra commands removed. comments added. 20101220
12# 3.0 - converted to sqlite. code cleanup. 20111030
13# 3.1 - search and help. 20111104
14# 3.2 - changed dbfile varname to prevent namespace collison 20120220
15# 4.0 - added db timestamping and karma expiry, changed scoring update loop. 20120828
16# 4.1 - karma entropy 20120903
17# 4.2 - !instant changes a random thing -/+1 , !random returns things. 20120905
18# 4.3 - locked text change, faster decay for high vals, trim item whitespace 20130215
19# 4.4 - Immortal karma (user request). Expanded stats. Fixes (locked text, high val decay) 20130526
20# TODO - randomize days a little on entropy
21
22### Usage ###
23# Once you have loaded this from your bots config and rehashed it,
24# do: .chanset #yourchannel +lkarma
25# In your channel you can "!<item>++" and "!<item>--" with any word or phrase.
26# "!good" and "!bad" return the top (and bottom) ten. "!khelp" for help.
27# "!lfind" returns locked items. "!ifind" returns immortalized items.
28# "!karma <item>" for score. "!stats" for total items and average karma (unlocked items).
29# "!find <item>" and "!rfind <item>" to search for things in the database.
30# "!instant" changes a random thing -/+1 , "!random" returns some items.
31# Privileged users can "!lock <item>", "!unlock <item>", and "!delete <item>"
32# They can also "!immortalize <item>" and remove it from entropy. Cannot be unset.
33
34### Settings ###
35# Set this to f allow friends in the bot to use karma (+f flag)
36# Set this to - if you want everyone to be able to.
37set karma(flags) "-|-"
38
39# Default flags allow only bot owners to lock/unlock karma.
40set karma(lockflags) "n|-"
41
42# Default flags allow only bot owners to delete karma from the database.
43set karma(deleteflags) "n|-"
44
45# x times in y seconds to trigger flood protection
46set kfflood 1000:300
47
48###############################################
49set karma(version) "4.4"
50setudef flag lkarma
51package require sqlite3
52set kdbfile "./lkarma.db"
53if {![file exists $kdbfile]} {
54 sqlite3 kdb $kdbfile
55 kdb eval {CREATE TABLE lkarma(item TEXT NOT NULL COLLATE NOCASE, karma INTEGER NOT NULL, locked TEXT NOT NULL default 'N', modtime INTEGER NOT NULL)}
56 kdb close
57}
58
59bind pubm $karma(flags) "% !*--" fixkarma
60bind pubm $karma(flags) "% !*++" fixkarma
61
62proc fixkarma {nick uhost hand chan text} {
63 global karma kdbfile kfcount kfflood
64 if {[string match "*+lkarma*" [channel info $chan]]} {
65 set nick [string map { "\{" "\\\{" "\}" "\\\}" "\[" "\\\[" "\]" "\\\]" } $nick]
66 set uhost [string tolower $uhost]
67 set chan [string tolower $chan]
68 set item [string range $text 1 [expr [string length $text] -3]]
69 set item [string trim $item]
70 sqlite3 kdb $kdbfile
71 if { [regexp -nocase {(.*)(\+|\-)$} $item] } {
72 puthelp "PRIVMSG $chan :\001ACTION sets mode -brain $nick\001"
73 return 0
74 }
75 if {$item == ""} {
76 puthelp "PRIVMSG $chan :What do you want to change?"
77 return 0
78 }
79 if {[string match -nocase *$nick* $item]} {
80 puthelp "PRIVMSG $chan :Self karma is a selfish pursuit."
81 return 0
82 }
83 if {[kdb eval {SELECT locked FROM lkarma WHERE item=$item}] == "Y"} {
84 set lockedk [kdb eval {SELECT karma FROM lkarma WHERE item=$item}]
85 if {$lockedk == 0} {
86 puthelp "PRIVMSG $chan :You can't change the karma of \002$item\002!"
87 } {
88 puthelp "PRIVMSG $chan :Karma for \002$item\002 is locked at \002$lockedk\002."
89 }
90 return 0
91 }
92 if {![info exists kfcount($uhost:$chan)]} {
93 set kfcount($uhost:$chan) 0
94 }
95 if {$kfcount($uhost:$chan) == [lindex $kfflood 0]} {
96 puthelp "PRIVMSG $chan :Please dont flood karma, $nick, try again later."
97 return 0
98 }
99 set score [string range $text end-1 end]
100 if {[string match "++" $score]} {
101 set scoring +1
102 } elseif {[string match "--" $score]} {
103 set scoring -1
104 }
105 incr kfcount($uhost:$chan)
106 set ktime [clock seconds]
107 if {[llength [kdb eval {SELECT karma FROM lkarma WHERE item=$item}]] == 0} {
108 kdb eval {INSERT INTO lkarma (item,karma,modtime) VALUES ($item,0,$ktime)}
109 }
110 if {[kdb eval {SELECT karma FROM lkarma WHERE item=$item}] < 900} {
111 kdb eval {UPDATE lkarma SET karma=karma+$scoring, modtime=$ktime WHERE item=$item}
112 } {
113 kdb eval {UPDATE lkarma SET karma=karma+$scoring WHERE item=$item}
114 }
115 set newkarma [kdb eval {SELECT karma FROM lkarma WHERE item=$item}]
116 puthelp "PRIVMSG $chan :Karma for \002$item\002 is now \002$newkarma\002."
117 kdb close
118 karmaupdate
119 }
120}
121
122###Other Commands###
123
124bind pub $karma(flags) !khelp karmahelp
125proc karmahelp {nick uhost hand chan text} {
126 if {[string match "*+lkarma*" [channel info $chan]]} {
127 if {![string match "" $text]} {return 0}
128 puthelp "PRIVMSG $chan :You may \002!<item>++\002 and \002!<item>--\002 any word or phrase. \002!good\002 and \002!bad\002 return the top (and bottom) ten. \002!karma <item>\002 for individual scores. \002!stats\002 for stats. Use \002!find <item>\002 and \002!rfind <item>\002 to search for things in the database, or just !random for ten random things."
129 }
130}
131
132bind pub $karma(flags) !karma checkkarma
133proc checkkarma {nick uhost hand chan text} {
134 if {[regexp -nocase {(.*)(\+\+|\-\-)$} $text]} {return 0}
135 if {[string match "*+lkarma*" [channel info $chan]]} {
136 global karma kdbfile
137 if {[string match "" $text]} {
138 puthelp "PRIVMSG $chan :$karma(version)"
139 return 0
140 } {
141 set item [string trim $text]
142 sqlite3 kdb $kdbfile
143 set current [kdb eval {SELECT karma FROM lkarma WHERE item=$item}]
144 if {[llength $current] == 0} {
145 set current 0
146 }
147 if {[kdb eval {SELECT locked FROM lkarma WHERE item=$item}] == "Y"} {
148 puthelp "PRIVMSG $chan :Karma for \002$item\002 is locked at \002$current\002."
149 } else {
150 puthelp "PRIVMSG $chan :Karma for \002$item\002 is currently \002$current\002."
151 }
152 if {[kdb eval {SELECT locked FROM lkarma WHERE item=$item}] == "U"} {
153 puthelp "PRIVMSG $chan :\002$item is immortalized!\002"
154 }
155 kdb close
156 }
157 }
158}
159
160bind pub $karma(flags) !stats karmastats
161proc karmastats {nick uhost hand chan text} {
162 if {![string match "" $text]} {return 0}
163 karmaupdate
164 global karma kdbfile
165 if {[string match "*+lkarma*" [channel info $chan]]} {
166 sqlite3 kdb $kdbfile
167 set lcount [kdb eval {SELECT COUNT(*) FROM lkarma WHERE locked='Y'}]
168 set ucount [kdb eval {SELECT COUNT(*) FROM lkarma WHERE locked='U'}]
169 set gcount [kdb eval {SELECT COUNT(*) FROM lkarma WHERE karma > 0 AND locked='N'}]
170 set bcount [kdb eval {SELECT COUNT(*) FROM lkarma WHERE karma < 0 AND locked='N'}]
171 set total [kdb eval {SELECT COUNT(*) FROM lkarma}]
172 set average [kdb eval {SELECT AVG(karma) FROM lkarma WHERE locked='N'}]
173 set average [expr round($average)]
174 puthelp "PRIVMSG $chan :Karma stats: \002$total\002 items in the database. Good:\002$gcount\002 Bad:\002$bcount\002 Average karma:\002$average\002. Locked:\002$lcount\002 Immortal:\002$ucount\002."
175 kdb close
176 }
177}
178
179bind pub $karma(flags) !good goodkarma
180proc goodkarma {nick uhost hand chan text} {
181 if {![string match "" $text]} {return 0}
182 karmaupdate
183 global karma kdbfile
184 if {[string match "*+lkarma*" [channel info $chan]]} {
185 sqlite3 kdb $kdbfile
186 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE locked='N' ORDER BY karma DESC LIMIT 0,10} ] {
187 append outvar "$item:\002$score\002 "
188 }
189 puthelp "PRIVMSG $chan :$outvar"
190 kdb close
191 }
192}
193
194bind pub $karma(flags) !bad badkarma
195proc badkarma {nick uhost hand chan text} {
196 if {![string match "" $text]} {return 0}
197 karmaupdate
198 global karma kdbfile
199 if {[string match "*+lkarma*" [channel info $chan]]} {
200 sqlite3 kdb $kdbfile
201 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE locked='N' ORDER BY karma ASC LIMIT 0,10}] {
202 append outvar "$item:\002$score\002 "
203 }
204 puthelp "PRIVMSG $chan :$outvar"
205 kdb close
206 }
207}
208
209bind pub $karma(flags) !lfind lockedkarma
210bind pub $karma(flags) !lkarma lockedkarma
211proc lockedkarma {nick uhost hand chan text} {
212 if {![string match "" $text]} {return 0}
213 karmaupdate
214 global karma kdbfile
215 if {[string match "*+lkarma*" [channel info $chan]]} {
216 sqlite3 kdb $kdbfile
217 set lcount [kdb eval {SELECT COUNT(*) FROM lkarma WHERE locked='Y'}]
218 if {$lcount != 0} {
219 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE locked='Y' ORDER BY karma DESC} ] {
220 append outvar "$item:\002$score\002 "
221 }
222 puthelp "PRIVMSG $chan :\002$lcount\002 locked items: $outvar"
223 } {
224 puthelp "PRIVMSG $chan :There are no locked items."
225 }
226 kdb close
227 }
228}
229
230bind pub $karma(flags) !ifind immkarma
231bind pub $karma(flags) !ikarma immkarma
232proc immkarma {nick uhost hand chan text} {
233 if {![string match "" $text]} {return 0}
234 karmaupdate
235 global karma kdbfile
236 if {[string match "*+lkarma*" [channel info $chan]]} {
237 sqlite3 kdb $kdbfile
238 set icount [kdb eval {SELECT COUNT(*) FROM lkarma WHERE locked='U'}]
239 if {$icount != 0} {
240 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE locked='U' ORDER BY karma DESC} ] {
241 append outvar "$item:\002$score\002 "
242 }
243 puthelp "PRIVMSG $chan :\002$icount\002 immortal items: $outvar"
244 } {
245 puthelp "PRIVMSG $chan :There are no immortal items."
246 }
247 kdb close
248 }
249}
250
251bind pub $karma(flags) !random randkarma
252proc randkarma {nick uhost hand chan text} {
253 if {![string match "" $text]} {return 0}
254 karmaupdate
255 global karma kdbfile
256 if {[string match "*+lkarma*" [channel info $chan]]} {
257 sqlite3 kdb $kdbfile
258 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE locked='N' ORDER BY RANDOM() LIMIT 10} ] {
259 append outvar "$item:\002$score\002 "
260 }
261 puthelp "PRIVMSG $chan :$outvar"
262 kdb close
263 }
264}
265
266bind pub $karma(flags) !instant instantkarma
267proc instantkarma {nick uhost hand chan text} {
268 if {![string match "" $text]} {return 0}
269 global karma kdbfile kfcount kfflood
270 if {[string match "*+lkarma*" [channel info $chan]]} {
271 set uhost [string tolower $uhost]
272 set chan [string tolower $chan]
273 sqlite3 kdb $kdbfile
274 if {![info exists kfcount($uhost:$chan)]} {
275 set kfcount($uhost:$chan) 0
276 }
277 if {$kfcount($uhost:$chan) == [lindex $kfflood 0]} {
278 puthelp "PRIVMSG $chan :Please dont flood karma, $nick, try again later."
279 return 0
280 }
281 incr kfcount($uhost:$chan)
282 lappend choices "+1" "-1"
283 set scoring [lindex $choices [expr {int(rand()*[llength $choices])}]]
284 putlog "$scoring instant karma randomly selected"
285 sqlite3 kdb $kdbfile
286 set ktime [clock seconds]
287 set rando [kdb onecolumn {SELECT item FROM lkarma WHERE locked='N' ORDER BY RANDOM() LIMIT 1}]
288 kdb eval {UPDATE lkarma SET karma=karma+$scoring, modtime=$ktime WHERE item=$rando}
289 set newkarma [kdb eval {SELECT karma FROM lkarma WHERE item=$rando}]
290 puthelp "PRIVMSG $chan :Karma for \002$rando\002 is now \002$newkarma\002."
291 kdb close
292 karmaupdate
293 }
294}
295
296bind pub $karma(flags) !find findkarma
297proc findkarma {nick uhost hand chan text} {
298 if {[regexp -nocase {(.*)(\+\+|\-\-)$} $text]} {return 0}
299 if {[string match "*+lkarma*" [channel info $chan]]} {
300 global karma kdbfile
301 if {[string match "" $text]} {
302 puthelp "PRIVMSG $chan :What should be found?"
303 } {
304 sqlite3 kdb $kdbfile
305 set word [string trim $text]
306 set spatrn "%$word%"
307 set scount [kdb eval {SELECT COUNT(1) FROM lkarma WHERE item LIKE $spatrn}]
308 if {$scount == 0 } {
309 puthelp "PRIVMSG $chan :\002$word\002 not found."
310 } {
311 if {$scount < 9 } {
312 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE item LIKE $spatrn ORDER BY karma DESC LIMIT 0,9}] {
313 append sreturn "$item:\002$score\002 "
314 }
315 puthelp "PRIVMSG $chan :\002$scount\002 matches for \002$word\002: $sreturn"
316 } {
317 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE item LIKE $spatrn ORDER BY karma DESC LIMIT 0,10}] {
318 append spos "$item:\002$score\002 "
319 }
320 puthelp "PRIVMSG $chan :\002$scount\002 matches for \002$word\002. Top 10 matches: $spos"
321 }
322 }
323 kdb close
324 }
325 }
326}
327
328bind pub $karma(flags) !rfind rfindkarma
329proc rfindkarma {nick uhost hand chan text} {
330 if {[regexp -nocase {(.*)(\+\+|\-\-)$} $text]} {return 0}
331 if {[string match "*+lkarma*" [channel info $chan]]} {
332 global karma kdbfile
333 if {[string match "" $text]} {
334 puthelp "PRIVMSG $chan :What should be found?"
335 } {
336 sqlite3 kdb $kdbfile
337 set word [string trim $text]
338 set spatrn "%$word%"
339 set scount [kdb eval {SELECT COUNT(1) FROM lkarma WHERE item LIKE $spatrn}]
340 if {$scount == 0 } {
341 puthelp "PRIVMSG $chan :\002$word\002 not found."
342 } {
343 if {$scount < 9 } {
344 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE item LIKE $spatrn ORDER BY karma ASC LIMIT 0,9}] {
345 append sreturn "$item:\002$score\002 "
346 }
347 puthelp "PRIVMSG $chan :\002$scount\002 matches for \002$word\002: $sreturn"
348 } {
349 foreach {item score} [kdb eval {SELECT item,karma FROM lkarma WHERE item LIKE $spatrn ORDER BY karma ASC LIMIT 0,10}] {
350 append sneg "$item:\002$score\002 "
351 }
352 puthelp "PRIVMSG $chan :\002$scount\002 matches for \002$word\002. Bottom 10 matches: $sneg"
353 }
354 }
355 kdb close
356 }
357 }
358}
359
360bind pub $karma(lockflags) !lock lockkarma
361proc lockkarma {nick uhost hand chan text} {
362 if {[regexp -nocase {(.*)(\+\+|\-\-)$} $text]} {return 0}
363 global karma kdbfile
364 if {[string match "*+lkarma*" [channel info $chan]]} {
365 set item [string trim $text]
366 if {$item == ""} {
367 puthelp "PRIVMSG $chan :What should be locked?"
368 return
369 }
370 sqlite3 kdb $kdbfile
371 if {[llength [kdb eval {SELECT locked FROM lkarma WHERE item=$item}]] == 0} {
372 puthelp "PRIVMSG $chan :\002$item\002 is not in the database."
373 } {
374 if {[kdb eval {SELECT locked FROM lkarma WHERE item=$item}] != "N"} {
375 puthelp "PRIVMSG $chan :\002$item\002 is already locked."
376 } {
377 kdb eval {UPDATE lkarma SET locked='Y' WHERE item=$item}
378 puthelp "PRIVMSG $chan :\002$item\002 locked."
379 }
380 }
381 kdb close
382 }
383}
384
385bind pub $karma(lockflags) !unlock unlockkarma
386proc unlockkarma {nick uhost hand chan text} {
387 if {[regexp -nocase {(.*)(\+\+|\-\-)$} $text]} {return 0}
388 global karma kdbfile
389 if {[string match "*+lkarma*" [channel info $chan]]} {
390 set item [string trim $text]
391 if {$item == ""} {
392 puthelp "PRIVMSG $chan :What should be unlocked?"
393 return
394 }
395 sqlite3 kdb $kdbfile
396 if {[llength [kdb eval {SELECT locked FROM lkarma WHERE item=$item}]] == 0} {
397 puthelp "PRIVMSG $chan :\002$item\002 is not in the database."
398 } {
399 if {[kdb eval {SELECT locked FROM lkarma WHERE item=$item}] != "Y"} {
400 puthelp "PRIVMSG $chan :\002$item\002 is not locked."
401 } {
402 kdb eval {UPDATE lkarma SET locked='N' WHERE item=$item}
403 puthelp "PRIVMSG $chan :\002$item\002 unlocked."
404 }
405 }
406 kdb close
407 }
408}
409
410bind pub $karma(lockflags) !immortalize immortkarma
411proc immortkarma {nick uhost hand chan text} {
412 if {[regexp -nocase {(.*)(\+\+|\-\-)$} $text]} {return 0}
413 global karma kdbfile
414 if {[string match "*+lkarma*" [channel info $chan]]} {
415 set item [string trim $text]
416 if {$item == ""} {
417 puthelp "PRIVMSG $chan :What should be immortalized?"
418 return
419 }
420 sqlite3 kdb $kdbfile
421 if {[llength [kdb eval {SELECT locked FROM lkarma WHERE item=$item}]] == 0} {
422 puthelp "PRIVMSG $chan :\002$item\002 is not in the database."
423 } {
424 if {[kdb eval {SELECT locked FROM lkarma WHERE item=$item}] == "U"} {
425 puthelp "PRIVMSG $chan :\002$item\002 is already immortalized."
426 } {
427 kdb eval {UPDATE lkarma SET locked='U' WHERE item=$item}
428 puthelp "PRIVMSG $chan :\002$item\002 immortalized!"
429 }
430 }
431 kdb close
432 }
433}
434
435bind pub $karma(deleteflags) !delete deletekarma
436proc deletekarma {nick uhost hand chan text} {
437 if {[regexp -nocase {(.*)(\+\+|\-\-)$} $text]} {return 0}
438 global karma kdbfile
439 if {[string match "*+lkarma*" [channel info $chan]]} {
440 set item [string trim $text]
441 if {$item == ""} {
442 puthelp "PRIVMSG $chan :What should be deleted?"
443 return
444 }
445 sqlite3 kdb $kdbfile
446 if {[llength [kdb eval {SELECT item FROM lkarma WHERE item=$item}]] == 0} {
447 puthelp "PRIVMSG $chan :\002$item\002 is not in the database."
448 } {
449 if {[kdb eval {SELECT locked FROM lkarma WHERE item=$item}] != "N"} {
450 puthelp "PRIVMSG $chan :\002$item\002 can't be deleted."
451 } {
452 kdb eval {DELETE FROM lkarma WHERE item=$item}
453 puthelp "PRIVMSG $chan :\002$item\002 deleted."
454 }
455 }
456 kdb close
457 }
458}
459
460####TIMER CODE###
461
462proc karmaupdate {} {
463 global kdbfile
464 sqlite3 kdb $kdbfile
465 set kutime [clock seconds]
466# plus/minus 1 to 5 days to kutime at random here? or in each loop?
467
468 set xtime [expr $kutime - (90 * 86400)]
469 kdb eval {DELETE FROM lkarma WHERE modtime < $xtime AND karma between -1 and 1 and locked='N'}
470 kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $xtime AND karma between 2 and 22 AND locked='N'}
471 kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $xtime AND karma between -22 and -2 AND locked='N'}
472
473 set ytime [expr $kutime - (30 * 86400)]
474 kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $ytime AND karma between 23 and 54 AND locked='N'}
475 kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $ytime AND karma between -54 and -23 AND locked='N'}
476
477 set yytime [expr $kutime - (7 * 86400)]
478 kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $yytime AND karma between 55 and 80 AND locked='N'}
479 kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $yytime AND karma between -80 and -55 AND locked='N'}
480
481 set yyytime [expr $kutime - (2 * 86400)]
482 kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $yyytime AND karma between 81 and 120 AND locked='N'}
483 kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $yyytime AND karma between -120 and -81 AND locked='N'}
484
485 set ztime [expr $kutime - 86400]
486 kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $ztime AND karma between 121 and 540 AND locked='N'}
487 kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $ztime AND karma between -540 and -121 AND locked='N'}
488
489 set zztime [expr $kutime - (86400 / 3)]
490 kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $zztime AND karma between 541 and 959 AND locked='N'}
491 kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $zztime AND karma between -959 and -541 AND locked='N'}
492
493 set zzztime [expr $kutime - (86400 / 5)]
494 kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $zzztime AND karma > 960 AND locked='N'}
495 kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $zzztime AND karma < -960 AND locked='N'}
496
497 kdb close
498}
499
500proc kfreset {} {
501 global kfcount kfflood
502 if {[info exists kfcount]} {
503 unset kfcount
504 }
505 utimer [lindex $kfflood 1] kfreset
506}
507
508if {![string match *kfreset* [utimers]]} {
509 global kfflood
510 utimer [lindex $kfflood 1] kfreset
511}
512set kfflood [split $kfflood :]
513
514
515putlog "LilyKarma $karma(version) loaded."