#################################################### # WindropClan @ http://windrop.clan.su # Автор: Vladislav # Версия: 1.0 # Описание: Скрипт позволяет сохранять в логфайле боту свои паблик сообщения. # А так же записывает, то что не записал флаг "p", например команды. #################################################### namespace eval selflog { variable logmsg "" bind log - * [namespace current]::logs1 bind pubm - * [namespace current]::logs2 bind out - "% sent" [namespace current]::logs3 proc logs1 {level chan text} { variable logmsg if {$level eq "p"} {set logmsg [list $chan [clock seconds] $text]} } proc logs2 {nick uhost hand chan text} { after 1 [list [namespace current]::alogs $nick $uhost $hand $chan $text] } proc alogs {nick uhost hand chan text} { variable logmsg if {$logmsg eq "" || ([lindex $logmsg 0] eq $chan && [expr [clock seconds]-[lindex $logmsg 1]] > 0 && [lindex $logmsg 2] ne "<$nick> $text")} {putloglev p $chan "<$nick> $text"} } proc logs3 {queue text sent} { if {[string match -nocase "privmsg *" $text]} { set chan [lindex [split $text] 1] set ind [string first : $text] set text [string range $text [expr $ind+1] end] if {[string match -nocase "\001action *" $text]} {after 10 [list putloglev p $chan "Action: $::botnick [string map -nocase {"\001" "" "action " ""} $text]"]} {after 10 [list putloglev p $chan "<$::botnick> $text"]} } } }