This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with seen.tcl error in blackseen

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

Help with seen.tcl error in blackseen

Post by janii »

Hello the best eggdrop community i need help with seen.tcl it gives me following error on eggdrop1.6.21
it ws working fine with eggdrop1.6.20
when i type !seen janii
if nick is online it says janii look in the mirror :)--> its fine
but when i type !seen nick if its not on channel it does nothing and i get this error in ctcp
Tcl error [recordz:seen]: missing operand at _@_
in expression "1358360443 - _@_"

Code: Select all

#################################################################
#             To activate .chanset +blackseen 
#
#               .seen *!*@host | !seen <nick>
#
##########################################################################

#Set here the flag required to use the command ? ( -|- for everyone )

set seen(flags) "-|-"


#Set here the first char.

set seen(chars) ". ! ` -"

#Anti-Flood Protection (searches:seconds)

set seen(flood) "4:5"

#Set here 1 daca if you want the messages to be trough NOTICE or 0 if you want
#to be trough PRIVMSG chan.

set seen(how) "0"

#After how many days the records will be deleted ?

set seen(limittime) "90"

#Timer-Time for checking ( hours )

set seen(verifytime) "12"


##########################################################################
#
#                              There`s no END
#
#
##########################################################################

foreach s(char) $seen(chars) {
bind pub $seen(flags) $s(char)seen recordz:seen
}
bind join - * record:join
bind join - * record:seened
bind part - * record:part
bind sign - * record:sign
bind kick - * record:kick
bind splt - * record:split
bind nick - * record:changenick
setudef flag blackseen
set dir "${username}.BlackSeen.db"
set dir1 "${username}.seenrecord.db"

if {![file exists $dir]} {
set file [open $dir w]
close $file
}

if {![file exists $dir1]} {
set file [open $dir1 w]
close $file
}


if {![info exists record:expire_running]} {
timer [expr $seen(verifytime) * 60] record:expire
set record:expire_running 1
}

proc record:join {nick host hand chan} {
global dir botnick
if {![channel get $chan blackseen]} {
return 0
}
set lin 0
set time [unixtime]
set host "*!$host"
if {[isbotnick $nick]} { return 0 }
set who "JOIN $chan $nick $host $time 0"
set file [open $dir "r"]
set database [read -nonewline $file]
close $file
set data [split $database "\n"]
foreach line $data {
set lin [expr $lin +1]
set userentry [lindex [split $line] 2]
set chanentry [lindex [split $line] 1]
if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} { 
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $data $num $num]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
if {$data == ""} {
set files [open $dir "w"]
close $files
}
set file [open $dir "a"]
puts $file "$who"
close $file
}

proc record:part {nick host hand chan arg} {
global dir botnick
if {![channel get $chan blackseen]} {
return 0
}
set lin 0
set time [unixtime]
set reason [join [lrange [split $arg] 0 end]]
if {$reason == ""} { set reason "No Reason"}
set host "*!$host"
if {[isbotnick $nick]} { return 0 }
set who "PART $chan $nick $host $time 0 $reason"
set file [open $dir "r"]
set database [read -nonewline $file]
close $file
set data [split $database "\n"]
foreach line $data {
set lin [expr $lin +1]
set userentry [lindex [split $line] 2]
set chanentry [lindex [split $line] 1]
if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} { 
set joined [lindex [split $line] 0]
if {$joined == "JOIN"} {
set j [lindex [split $line] 4]
set who "PART $chan $nick $host $time $j $reason"
}
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $data $num $num]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
if {$data == ""} {
set files [open $dir "w"]
close $files
}
set file [open $dir "a"]
puts $file "$who"
close $file
}


proc record:sign {nick host hand chan arg} {
global dir botnick
if {![channel get $chan blackseen]} {
return 0
}
set lin 0
set time [unixtime]
set host "*!$host"
set reason [join [lrange [split $arg] 0 end]]
if {$reason == ""} { set reason "No Reason"}
if {[isbotnick $nick]} { return 0 }
set who "SIGN $chan $nick $host $time 0 $reason"
set file [open $dir "r"]
set database [read -nonewline $file]
close $file
set data [split $database "\n"]
foreach line $data {
set lin [expr $lin +1]
set userentry [lindex [split $line] 2]
set chanentry [lindex [split $line] 1]
if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} { 
set joined [lindex [split $line] 0]
if {$joined == "JOIN"} {
set j [lindex [split $line] 4]
set who "SIGN $chan $nick $host $time $j $reason"
}
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $data $num $num]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
if {$data == ""} {
set files [open $dir "w"]
close $files
}
set file [open $dir "a"]
puts $file "$who"
close $file
}

proc record:kick {nick host hand chan kicked reason} {
global dir botnick
if {![channel get $chan blackseen]} {
return 0
}
set lin 0
set time [unixtime]
set hosted [getchanhost $kicked $chan]
set hosted "*!$hosted"
set reason [join [lrange [split $reason] 0 end]]
if {[isbotnick $kicked]} { return 0 }
set who "KICK $chan $kicked $hosted $time 0 $reason"
set file [open $dir "r"]
set database [read -nonewline $file]
close $file
set data [split $database "\n"]
foreach line $data {
set lin [expr $lin +1]
set userentry [lindex [split $line] 2]
set chanentry [lindex [split $line] 1]
if {[string equal -nocase $userentry $kicked] && [string match -nocase $chanentry $chan]} { 
set joined [lindex [split $line] 0]
if {$joined == "JOIN"} {
set j [lindex [split $line] 4]
set who "KICK $chan $kicked $hosted $time $j $reason"
}
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $data $num $num]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
if {$data == ""} {
set files [open $dir "w"]
close $files
}
set file [open $dir "a"]
puts $file "$who"
close $file
}


proc record:split {nick host hand chan args} {
global dir botnick
if {![channel get $chan blackseen]} {
return 0
}
set lin 0
set time [unixtime]
set host "*!$host"
if {[isbotnick $nick]} { return 0 }
set who "SPLIT $chan $nick $host $time 0"
set file [open $dir "r"]
set database [read -nonewline $file]
close $file
set data [split $database "\n"]
foreach line $data {
set lin [expr $lin +1]
set userentry [lindex [split $line] 2]
set chanentry [lindex [split $line] 1]
if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} { 
set joined [lindex [split $line] 0]
if {$joined == "JOIN"} {
set j [lindex [split $line] 4]
set who "SPLIT $chan $nick $host $time $j"
}
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $data $num $num]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
if {$data == ""} {
set files [open $dir "w"]
close $files
}
set file [open $dir "a"]
puts $file "$who"
close $file
}

proc record:changenick {nick host hand chan newnick} {
global dir botnick
if {![channel get $chan blackseen]} {
return 0
}
set lin 0
set time [unixtime]
set host "*!$host"
if {[isbotnick $nick]} { return 0 }
set who "NICKCHANGE $chan $nick $host $time 0 $newnick"
set file [open $dir "r"]
set database [read -nonewline $file]
close $file
set data [split $database "\n"]
foreach line $data {
set lin [expr $lin +1]
set userentry [lindex [split $line] 2]
set chanentry [lindex [split $line] 1]
if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} { 
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $data $num $num]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
if {$data == ""} {
set files [open $dir "w"]
close $files
}
set file [open $dir "a"]

puts $file "$who"
close $file
}

proc recordz:seen {nick uhost hand chan arg} {
global dir dir1 seen count botnick
if {![channel get $chan blackseen]} {
return 0
}
set i 0
set what [lindex [split $arg] 0]
set number [scan $seen(flood) %\[^:\]]
set timer [scan $seen(flood) %*\[^:\]:%s]
foreach tmr [utimers] {
if {[string match "*count(flood:$uhost:$chan)*" [join [lindex $tmr 1]]]} {
killutimer [lindex $tmr 2]
}
}
if {![info exists count(flood:$uhost:$chan)]} { 
set count(flood:$uhost:$chan) 0 
}
incr count(flood:$uhost:$chan)
utimer $timer [list unset count(flood:$uhost:$chan)]

if {$count(flood:$uhost:$chan) == "$number"} {
puthelp "NOTICE $nick :Asteapta 1 minut inainte de a incepe cautarea."
return 0
}

if {[string match -nocase $what $nick]} { puthelp "NOTICE $nick :5$nick look in the mirror :)"
return 0
}
if {[onchan $what $chan]} { puthelp "NOTICE $nick :4$what 5is already on $chan :)"
return 0
}

set file [open $dir "r"]
set database [read -nonewline $file]
close $file
if {$database == ""} { puthelp "NOTICE $nick :5I dont have any record in my database."
return 0
}
if {![string match -nocase "*!*" "$what"]} {
set time [unixtime]
set mask "$nick!$uhost"
seen:rec $what $chan $time $mask
}

set data [split $database "\n"]
foreach line $data {
set how [lindex [split $line] 0]
set userentry [lindex [split $line] 2]
set chanentry [lindex [split $line] 1]
set host [lindex [split $line] 3]
set timer [lindex [split $line] 4]
set jointime [lindex [split $line] 5]
set reason [lrange [split $line] 6 end]
set newnick [lindex [split $line] 6]
set totalyear [expr [unixtime] - $timer]
if {$totalyear >= 31536000} {
		set yearsfull [expr $totalyear/31536000]
		set years [expr int($yearsfull)]
		set yearssub [expr 31536000*$years]
		set totalday [expr $totalyear - $yearssub]
	}
	if {$totalyear < 31536000} {
		set totalday $totalyear
		set years 0
	}
	if {$totalday >= 86400} {
		set daysfull [expr $totalday/86400]
		set days [expr int($daysfull)]
		set dayssub [expr 86400*$days]
		set totalhour [expr $totalday - $dayssub]
	}
	if {$totalday < 86400} {
		set totalhour $totalday
		set days 0
	}
	if {$totalhour >= 3600} {
		set hoursfull [expr $totalhour/3600]
		set hours [expr int($hoursfull)]
		set hourssub [expr 3600*$hours]
		set totalmin [expr $totalhour - $hourssub]
	}
	if {$totalhour < 3600} {
		set totalmin $totalhour
		set hours 0
	}
	if {$totalmin >= 60} {
		set minsfull [expr $totalmin/60]
		set mins [expr int($minsfull)]
	}
	if {$totalmin < 60} {
		set mins 0
	}
	if {$years < 1} {set yearstext ""} elseif {$years == 1} {set yearstext "$years year, "} {set yearstext "$years years, "}

	if {$days < 1} {set daystext ""} elseif {$days == 1} {set daystext "$days day, "} {set daystext "$days days, "}

	if {$hours < 1} {set hourstext ""} elseif {$hours == 1} {set hourstext "$hours hour, "} {set hourstext "$hours hours, "}

	if {$mins < 1} {set minstext ""} elseif {$mins == 1} {set minstext "$mins minute"} {set minstext "$mins minutes"}

	set output $yearstext$daystext$hourstext$minstext

if {$totalyear < 60} {
set output "$totalyear seconds"
}
set staytime [expr [unixtime] - $jointime]
set stayt [expr $timer - $jointime]
if {$stayt >= 31536000} {
		set yearsfull [expr $stayt/31536000]
		set years [expr int($yearsfull)]
		set yearssub [expr 31536000*$years]
		set totalday [expr $stayt - $yearssub]
	}
	if {$stayt < 31536000} {
		set totalday $stayt
		set years 0
	}
	if {$totalday >= 86400} {
		set daysfull [expr $totalday/86400]
		set days [expr int($daysfull)]
		set dayssub [expr 86400*$days]
		set totalhour [expr $totalday - $dayssub]
	}
	if {$totalday < 86400} {
		set totalhour $totalday
		set days 0
	}
	if {$totalhour >= 3600} {
		set hoursfull [expr $totalhour/3600]
		set hours [expr int($hoursfull)]
		set hourssub [expr 3600*$hours]
		set totalmin [expr $totalhour - $hourssub]
	}
	if {$totalhour < 3600} {
		set totalmin $totalhour
		set hours 0
	}
	if {$totalmin >= 60} {
		set minsfull [expr $totalmin/60]
		set mins [expr int($minsfull)]
	}
	if {$totalmin < 60} {
		set mins 0
	}
	if {$years < 1} {set yearstext ""} elseif {$years == 1} {set yearstext "$years year, "} {set yearstext "$years years, "}

	if {$days < 1} {set daystext ""} elseif {$days == 1} {set daystext "$days day, "} {set daystext "$days days, "}

	if {$hours < 1} {set hourstext ""} elseif {$hours == 1} {set hourstext "$hours hour, "} {set hourstext "$hours hours, "}

	if {$mins < 1} {set minstext ""} elseif {$mins == 1} {set minstext "$mins minute"} {set minstext "$mins minutes"}

	set staytime $yearstext$daystext$hourstext$minstext

if {$stayt < 60} {
set staytime "$stayt seconds"
}
set date  [clock format $timer -format %d.%m.]
set hour  [clock format $timer -format %H:%M]
if {$jointime == "0"} { set staymsg "5I dont know how much he stayed."
} else { set staymsg "5after staying $staytime on $chan."}
if {[string equal -nocase $userentry $what] && [string match -nocase $chanentry $chan]} { 
set host [string trim $host "*!~"]
set i [expr $i +1]
if {$i < 6} {
lappend entry $userentry
}
set seenfound 1

if {[lindex [split $line] 0] == "PART"} {
set reply "4[join $entry ","] 6($host) 5left $chan about $output ($date $hour) stating: $reason, $staymsg"
}
if {[lindex [split $line] 0] == "SIGN"} {
set reply "4[join $entry ","] 6($host) 5left IRC about $output ($date $hour) stating: $reason, $staymsg"
}
if {[lindex [split $line] 0] == "JOIN"} {
if {[onchan $what $chan]} { set nowon "$what 5is still here."} else { set nowon "5I dont see $what on $chan" }
set reply "4[join $entry ","] 6($host) 5joined $chan about $output ($date $hour).$nowon"
}
if {[lindex [split $line] 0] == "SPLIT"} {
set reply "4[join $entry ","] 6($host) 5left in *.net *.split about $output ($date $hour), $staymsg"
}
if {[lindex [split $line] 0] == "KICK"} {
set reply "4[join $entry ","] 6($host) 5was kicked on $chan about $output ($date $hour) with the reason ($reason), $staymsg"
}
if {[lindex [split $line] 0] == "NICKCHANGE"} {
if {[onchan $newnick $chan]} { set nowon "4$newnick 5is stil here." } else { set nowon "I dont see $newnick on $chan" }
set reply "4[join $entry ","] 6($host) 5changed NICK to $newnick about $output ($date $hour).$nowon"
}
}
if {$what == "*!*@*"} { return 0 }
if {[string match -nocase $what $host] && [string match -nocase $chanentry $chan]} {
set host [string trim $host "*!~"]
set i [expr $i +1]
if {$i < 6} {
lappend entry $userentry
}

set seenfound 1
if {[lindex [split $line] 0] == "PART"} {
set reply "[join $entry ","] 4($host) 5left $chan about $output ($date $hour) stating: $reason, $staymsg"
}
if {[lindex [split $line] 0] == "SIGN"} {
set reply "[join $entry ","] 4($host) 5left IRC about $output ($date $hour) stating: $reason, $staymsg"
}
if {[lindex [split $line] 0] == "JOIN"} {
if {[onchan $userentry $chan]} { set nowon "$userentry is stil here."} else { set nowon "I dont see $userentry on $chan" }
set reply "[join $entry ","] 4($host) 5joined $chan about $output ($date $hour).$nowon"
}
if {[lindex [split $line] 0] == "SPLIT"} {
set reply "[join $entry ","] 4($host) 5left in *.net *.split about $output ($date $hour), $staymsg"
}
if {[lindex [split $line] 0] == "KICK"} {
set reply "[join $entry ","] 4($host) 5was kicked on $chan about $output ($date $hour) with the reason ($reason), $staymsg"
}
if {[lindex [split $line] 0] == "NICKCHANGE"} {
if {[onchan $newnick $chan]} { set nowon "$newnick 5is still here." } else { set nowon "I dont see $newnick on $chan" }
set reply "[join $entry ","] 4($host) 5changed NICK to $newnick about $output ($date $hour).$nowon"
}
}

}
if {[info exists reply]} {
if {$seen(how) == "1"} {
puthelp "NOTICE $nick :$reply"
} else { puthelp "PRIVMSG $chan :$reply"
}
}

if {![info exists seenfound]} {
puthelp "NOTICE $nick :I dont remember $what."
}
}

proc seen:rec {nick chan time who} {
global dir1
set lin 0
set w "$nick $chan $time $who"
if {[isbotnick $nick]} { return 0 }
set filez [open $dir1 "r"]
set databases [read -nonewline $filez]
close $filez
set datas [split $databases "\n"]
foreach line $datas {
set lin [expr $lin +1]
set userentry [lindex [split $line] 0]
set chanentry [lindex [split $line] 1]
set inculpat [lindex [split $line] 3]
if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} { 
set w "$nick $chan $time $who"
if {![string match -nocase $inculpat $who]} {
lappend wer $inculpat $who
set w "$nick $chan $time [join $wer " , "]"
}

if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $datas $num $num]
set files [open $dir1 "w"]
puts $files [join $delete "\n"]
close $files
}
}

}
set filez [open $dir1 "r"]
set datas [read -nonewline $filez]
close $filez
if {$datas == ""} {
set files [open $dir1 "w"]
close $files
}
set filez [open $dir1 "a"]
puts $filez "$w"
close $filez
}

proc record:seened {nick host hand chan} {
global dir1
if {![channel get $chan blackseen]} {
return 0
}
set lin 0
set filez [open $dir1 "r"]
set databases [read -nonewline $filez]
close $filez
set datas [split $databases "\n"]
foreach line $datas {
set lin [expr $lin +1]
set userentry [lindex [split $line] 0]
set chanentry [lindex [split $line] 1]
if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} { 
set time [lindex [split $line] 2]
set date  [clock format $time -format %d.%m.]
set hour  [clock format $time -format %H:%M]
set totalyear [expr [unixtime] - $time]
if {$totalyear >= 31536000} {
		set yearsfull [expr $totalyear/31536000]
		set years [expr int($yearsfull)]
		set yearssub [expr 31536000*$years]
		set totalday [expr $totalyear - $yearssub]
	}
	if {$totalyear < 31536000} {
		set totalday $totalyear
		set years 0
	}
	if {$totalday >= 86400} {
		set daysfull [expr $totalday/86400]
		set days [expr int($daysfull)]
		set dayssub [expr 86400*$days]
		set totalhour [expr $totalday - $dayssub]
	}
	if {$totalday < 86400} {
		set totalhour $totalday
		set days 0
	}
	if {$totalhour >= 3600} {
		set hoursfull [expr $totalhour/3600]
		set hours [expr int($hoursfull)]
		set hourssub [expr 3600*$hours]
		set totalmin [expr $totalhour - $hourssub]
	}
	if {$totalhour < 3600} {
		set totalmin $totalhour
		set hours 0
	}
	if {$totalmin >= 60} {
		set minsfull [expr $totalmin/60]
		set mins [expr int($minsfull)]
	}
	if {$totalmin < 60} {
		set mins 0
	}
	if {$years < 1} {set yearstext ""} elseif {$years == 1} {set yearstext "$years an, "} {set yearstext "$years ani, "}

	if {$days < 1} {set daystext ""} elseif {$days == 1} {set daystext "$days zi, "} {set daystext "$days zile, "}

	if {$hours < 1} {set hourstext ""} elseif {$hours == 1} {set hourstext "$hours ora, "} {set hourstext "$hours ore, "}

	if {$mins < 1} {set minstext ""} elseif {$mins == 1} {set minstext "$mins minut"} {set minstext "$mins minute"}

	set howmuch $yearstext$daystext$hourstext$minstext

if {$totalyear < 60} {
set howmuch "$totalyear secunde"
}

set bywho [lrange [split $line] 3 end]
puthelp "NOTICE $nick :$bywho looked for you with !seen on $chan about $howmuch ($date $hour)."
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $datas $num $num]
set files [open $dir1 "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
}

proc record:expire {} {
global dir seen
putlog "(BlackSeen) Checking informations..."
set curtime [unixtime]
set lin 0
set countlin 0
set day 86400
set file [open $dir "r"]
set database [read -nonewline $file]
close $file
set data [split $database "\n"]
foreach line $data {
set lin [expr $lin +1]
set lastseen [lindex [split $line] 4]
set limitseen [expr ($curtime - $lastseen)/$day]
if {$limitseen > $seen(limittime)} {
set countlin [expr $countlin +1]
if {$line != ""} {
set num [expr $lin - 1]
set delete [lreplace $data $num $num]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
}
}
}
putlog "(BlackSeen) Found $countlin expired information."
timer [expr $seen(verifytime) * 60] record:expire
return 1
}


putlog "5 Seen.tcl by black Loaded "
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Seems like a database problem of some kind.

The code involved in the error is one of these expressions...

Code: Select all

set data [split $database "\n"] 
foreach line $data { 

set timer [lindex [split $line] 4] 
set jointime [lindex [split $line] 5] 

set totalyear [expr [unixtime] - $timer] 

set staytime [expr [unixtime] - $jointime] 

Look in the database file and see if the lines have numbers as the values for the 5th and 6th items in every line of data.

Paste a few lines from your database file here.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

Post by janii »

this is the database file pasting few lines here

Code: Select all

JOIN #TriviaPoint KrazyKiller *!comp@flying.to.kyrgyzstan.kg 1358558954 0
NICKCHANGE #TriviaPoint pamintangdurog *!~yami@49.144.134.218 1358559190 0 dibdib
NICKCHANGE #TriviaPoint _Bourne *!duh@inva1id.h-o-s-t.name 1358559338 0 Bourne
NICKCHANGE #unopoint _Bourne *!duh@inva1id.h-o-s-t.name 1358559339 0 Bourne
NICKCHANGE #TriviaPoint Guest23870 *!duh@inva1id.h-o-s-t.name 1358559402 0 Bourne
NICKCHANGE #unopoint Guest23870 *!duh@inva1id.h-o-s-t.name 1358559403 0 Bourne
SIGN #TriviaPoint dibdib *!~yami@49.144.134.218 1358559847 0 Quit: 
JOIN #TriviaPoint |Sting| *!sheshi@h4ck3d.shell.la 1358560532 0
JOIN #TriviaPoint JK- *!sheshi@inva1id.h-o-s-t.name 1358560593 0
JOIN #TriviaPoint DualBase *!sheshi@burning.in.flamex.hm 1358560606 0
SIGN #TriviaPoint Midas *!~Someone@64.62.201.6 1358561351 1358559446 Quit: Power Failure.. Sorry Peer Its Not Your Day Today !!
JOIN #TriviaPoint BuRaQ *!BuRaQ@unity.lineux.net 1358562004 0
JOIN #TriviaPoint SharkTech *!BuRaQ@ir.awan.uk.to 1358562094 0
JOIN #TriviaPoint Gam3rs *!smiley@i.am.the.packet-lord.hm 1358562275 0
JOIN #TriviaPoint ZaWiSh *!Panku@inva1id.h-o-s-t.name 1358562729 0
JOIN #TriviaPoint DeadDeviL *!Panku@sh0vv.biz.tm 1358562769 0
JOIN #TriviaPoint Nok|a *!Panku@BoUrJI.BoUrJI.Go.org.Ve 1358562783 0
NICKCHANGE #TriviaPoint Guest31401 *!duh@inva1id.h-o-s-t.name 1358562843 0 Bourne
NICKCHANGE #unopoint Guest31401 *!duh@inva1id.h-o-s-t.name 1358562843 0 Bourne
JOIN #TriviaPoint Nickeon *!chicks@c0me.smoke.w33d.wid.us.to 1358562880 0
NICKCHANGE #TriviaPoint Guest35768 *!duh@inva1id.h-o-s-t.name 1358562907 0 Bourne
NICKCHANGE #unopoint Guest35768 *!duh@inva1id.h-o-s-t.name 1358562907 0 Bourne
JOIN #TriviaPoint P0wer *!chicks@k1ng.0f.as1an.continent.kz 1358562924 0
NICKCHANGE #TriviaPoint Bourne *!duh@inva1id.h-o-s-t.name 1358562972 0 Guest36211
NICKCHANGE #unopoint Bourne *!duh@inva1id.h-o-s-t.name 1358562972 0 Guest36211
NICKCHANGE #unopoint Kaye *!daemon@youre.th3.chickenkiller.com 1358563574 0 kaye^afk
JOIN #TriviaPoint Fritter *!Tanu@burning.in.flamex.hm 1358563700 0
JOIN #TriviaPoint Tsuname *!Tanu@burning.in.flamex.hm 1358563774 0
JOIN #TriviaPoint XBase *!Tanu@inva1id.h-o-s-t.name 1358563790 0
JOIN #TriviaPoint rDNs *!BuRaQ@want.sky-chat.net 1358563911 0
SIGN #TriviaPoint Sinis_smooth *!panny@46-161-29.adsl.cyta.gr 1358564244 0 Ping timeout
JOIN #TriviaPoint JuR|St *!r00t@love.you.stes.fi 1358564256 0
JOIN #unopoint JuR|St *!r00t@love.you.stes.fi 1358564272 0
NICKCHANGE #unopoint kaye^afk *!daemon@youre.th3.chickenkiller.com 1358564493 0 Kaye
SIGN #TriviaPoint Tum *!~Tum@175.107.33.187 1358564831 1358564463 Quit: 
NICKCHANGE #TriviaPoint Sinis_green *!~panny@ppp-94-66-37-240.home.otenet.gr 1358565107 0 Sinis_smooth
JOIN #TriviaPoint Rickey *!mulk@Ash3s.and.flamex.hm 1358565565 0
JOIN #TriviaPoint Deccon *!mulk@gangsta.vlab.pp.ru 1358565595 0
NICKCHANGE #unopoint Guest43178 *!bliss@204.188.223.35 1358566046 0 `RoGue
NICKCHANGE #unopoint Guest10173 *!bliss@Theres.No.One.Else.Like.me.plc.com.pk 1358566914 0 `RoGue
JOIN #unopoint `RoGue *!bliss@Theres.No.One.Else.Like.me.plc.com.pk 1358567248 0
JOIN #TriviaPoint BugBunny *!Died@qaidi.number.4040.idv.tw 1358567881 0
JOIN #TriviaPoint Crazy4u *!hiren@wtf.is-happening.arno.fi 1358567893 0
JOIN #TriviaPoint Pr0grammer *!hiren@gu.labo.ch 1358567908 0
JOIN #TriviaPoint BanGaLi-BaBa *!Died@killed.the.good.one.pl 1358567911 0
JOIN #TriviaPoint Bangash *!daniya@love.you.stes.fi 1358567971 0
JOIN #TriviaPoint Her0 *!hiren@an.armed.us 1358567985 0
NICKCHANGE #TriviaPoint Guest67161 *!kuting@hunnie.bunnie.loves.fishy.kisses.uk.to 1358568021 0 Shugar
JOIN #TriviaPoint mayyah *!daniya@wanted.by.nlpd.net.au 1358568090 0
JOIN #TriviaPoint PkStud *!Chris@BoUrJI.BoUrJI.Go.org.Ve 1358568662 0
JOIN #TriviaPoint Aron *!Chris@janec.modified.lukaret.kaye.ang.mga.maoy.sa.0x69.net 1358568706 0
JOIN #TriviaPoint HunterAlpha *!Chris@wazzup.b.ro.lt 1358568722 0
JOIN #TriviaPoint Excessive *!bakra@y0u.cant.h4ck.me 1358569874 0
JOIN #TriviaPoint Mina *!bakra@having.dashing.eye.rs 1358569950 0
JOIN #TriviaPoint H_P *!bakra@Fear.0f.Darkworlds.Org 1358570039 0
JOIN #TriviaPoint Timwari *!CoolSpot@ma.cow.goes.mooo.com 1358570630 0
PART #TriviaPoint Johnson77 *!Mibbit@39.54.23.124 1358571989 1358570525 No Reason
NICKCHANGE #TriviaPoint Yna *!barbie@im.really.sexy.shoow.us 1358572038 0 barbie^^
NICKCHANGE #unopoint Yna *!barbie@im.really.sexy.shoow.us 1358572039 0 barbie^^
NICKCHANGE #TriviaPoint barbie^^ *!barbie@im.really.sexy.shoow.us 1358572261 0 Yna
NICKCHANGE #unopoint barbie^^ *!barbie@im.really.sexy.shoow.us 1358572262 0 Yna
SIGN #TriviaPoint yci *!~opera@109.100.24.112 1358572679 1358565405 Quit: yci
JOIN #TriviaPoint ThUnDeR_ *!~SToRMy@110.39.68.241 1358572935 0
JOIN #TriviaPoint Madira *!thirsty@Fear.0f.Darkworlds.Org 1358574052 0
JOIN #unopoint butchokoy *!~me2@112.198.82.3 1358574799 0
JOIN #TriviaPoint Hylcon *!thirsty@y0u.cant.h4ck.me 1358575005 0
PART #TriviaPoint petula *!~petula@78.133.15.126 1358575107 1358574917 No Reason
SIGN #TriviaPoint gparted *!~Arc0r@121.54.58.149 1358575166 1358571930 Quit: :/
SIGN #TriviaPoint bugsbuddy *!bugs@39.54.91.39 1358576166 1358568737 Quit: 
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Code: Select all

##########################################################################
#
#                             BlackSeen 1.3
#
#
#                                             BLaCkShaDoW ProductionS
##########################################################################
#
#-it`s a new type of seen
#-it has a database foreach channel.
#-tcl-ul logs where is activate.
#-now it shows how much time the user stayed on chan.
#-added a system to notify users on join, if they were searched with !seen
#-added a timer to erase old records.
#
#             To activate .chanset +blackseen
#
#               .seen *!*@host | !seen <nick>
#
##########################################################################

#Set here the flag required to use the command ? ( -|- for everyone )

set seen(flags) "-|-"


#Set here the first char.

set seen(chars) ". ! ` -"

#Anti-Flood Protection (searches:seconds)

set seen(flood) "4:5"

#Set here 1 daca if you want the messages to be trough NOTICE or 0 if you want
#to be trough PRIVMSG chan.

set seen(how) "1"

#After how many days the records will be deleted ?

set seen(limittime) "90"

#Timer-Time for checking ( hours )

set seen(verifytime) "12"


##########################################################################
#
#                              There`s no END
#
#
##########################################################################

foreach s(char) $seen(chars) {
	bind pub $seen(flags) $s(char)seen recordz:seen
}
bind join - * record:join
bind join - * record:seened
bind part - * record:part
bind sign - * record:sign
bind kick - * record:kick
bind splt - * record:split
bind nick - * record:changenick
setudef flag blackseen
set dir "${username}.BlackSeen.db"
set dir1 "${username}.seenrecord.db"

if {![file exists $dir]} {
	set file [open $dir w]
	close $file
}

if {![file exists $dir1]} {
	set file [open $dir1 w]
	close $file
}


if {![info exists record:expire_running]} {
	timer [expr $seen(verifytime) * 60] record:expire
	set record:expire_running 1
}

proc record:join {nick host hand chan} {
	global dir botnick
	if {![channel get $chan blackseen]} {
		return 0
	}
	set lin 0
	set time [unixtime]
	set host "*!$host"
	if {[isbotnick $nick]} { return 0 }
	set who "JOIN $chan $nick $host $time 0"
	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	set data [split $database "\n"]
	foreach line $data {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 2]
		set chanentry [lindex [split $line] 1]
		if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $data $num $num]
				set files [open $dir "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
	set file [open $dir "r"]
	set data [read -nonewline $file]
	close $file
	if {$data == ""} {
		set files [open $dir "w"]
		close $files
	}
	set file [open $dir "a"]
	puts $file "$who"
	close $file
}

proc record:part {nick host hand chan arg} {
	global dir botnick
	if {![channel get $chan blackseen]} {
		return 0
	}
	set lin 0
	set time [unixtime]
	set reason [join [lrange [split $arg] 0 end]]
	if {$reason == ""} { set reason "No Reason"}
	set host "*!$host"
	if {[isbotnick $nick]} { return 0 }
	set who "PART $chan $nick $host $time 0 $reason"
	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	set data [split $database "\n"]
	foreach line $data {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 2]
		set chanentry [lindex [split $line] 1]
		if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
			set joined [lindex [split $line] 0]
			if {$joined == "JOIN"} {
				set j [lindex [split $line] 4]
				set who "PART $chan $nick $host $time $j $reason"
			}
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $data $num $num]
				set files [open $dir "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
	set file [open $dir "r"]
	set data [read -nonewline $file]
	close $file
	if {$data == ""} {
		set files [open $dir "w"]
		close $files
	}
	set file [open $dir "a"]
	puts $file "$who"
	close $file
}


proc record:sign {nick host hand chan arg} {
	global dir botnick
	if {![channel get $chan blackseen]} {
		return 0
	}
	set lin 0
	set time [unixtime]
	set host "*!$host"
	set reason [join [lrange [split $arg] 0 end]]
	if {$reason == ""} { set reason "No Reason"}
	if {[isbotnick $nick]} { return 0 }
	set who "SIGN $chan $nick $host $time 0 $reason"
	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	set data [split $database "\n"]
	foreach line $data {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 2]
		set chanentry [lindex [split $line] 1]
		if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
			set joined [lindex [split $line] 0]
			if {$joined == "JOIN"} {
				set j [lindex [split $line] 4]
				set who "SIGN $chan $nick $host $time $j $reason"
			}
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $data $num $num]
				set files [open $dir "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
	set file [open $dir "r"]
	set data [read -nonewline $file]
	close $file
	if {$data == ""} {
		set files [open $dir "w"]
		close $files
	}
	set file [open $dir "a"]
	puts $file "$who"
	close $file
}

proc record:kick {nick host hand chan kicked reason} {
	global dir botnick
	if {![channel get $chan blackseen]} {
		return 0
	}
	set lin 0
	set time [unixtime]
	set hosted [getchanhost $kicked $chan]
	set hosted "*!$hosted"
	set reason [join [lrange [split $reason] 0 end]]
	if {[isbotnick $kicked]} { return 0 }
	set who "KICK $chan $kicked $hosted $time 0 $reason"
	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	set data [split $database "\n"]
	foreach line $data {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 2]
		set chanentry [lindex [split $line] 1]
		if {[string equal -nocase $userentry $kicked] && [string match -nocase $chanentry $chan]} {
			set joined [lindex [split $line] 0]
			if {$joined == "JOIN"} {
				set j [lindex [split $line] 4]
				set who "KICK $chan $kicked $hosted $time $j $reason"
			}
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $data $num $num]
				set files [open $dir "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
	set file [open $dir "r"]
	set data [read -nonewline $file]
	close $file
	if {$data == ""} {
		set files [open $dir "w"]
		close $files
	}
	set file [open $dir "a"]
	puts $file "$who"
	close $file
}


proc record:split {nick host hand chan args} {
	global dir botnick
	if {![channel get $chan blackseen]} {
		return 0
	}
	set lin 0
	set time [unixtime]
	set host "*!$host"
	if {[isbotnick $nick]} { return 0 }
	set who "SPLIT $chan $nick $host $time 0"
	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	set data [split $database "\n"]
	foreach line $data {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 2]
		set chanentry [lindex [split $line] 1]
		if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
			set joined [lindex [split $line] 0]
			if {$joined == "JOIN"} {
				set j [lindex [split $line] 4]
				set who "SPLIT $chan $nick $host $time $j"
			}
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $data $num $num]
				set files [open $dir "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
	set file [open $dir "r"]
	set data [read -nonewline $file]
	close $file
	if {$data == ""} {
		set files [open $dir "w"]
		close $files
	}
	set file [open $dir "a"]
	puts $file "$who"
	close $file
}

proc record:changenick {nick host hand chan newnick} {
	global dir botnick
	if {![channel get $chan blackseen]} {
		return 0
	}
	set lin 0
	set time [unixtime]
	set host "*!$host"
	if {[isbotnick $nick]} { return 0 }
	set who "NICKCHANGE $chan $nick $host $time 0 $newnick"
	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	set data [split $database "\n"]
	foreach line $data {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 2]
		set chanentry [lindex [split $line] 1]
		if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $data $num $num]
				set files [open $dir "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
	set file [open $dir "r"]
	set data [read -nonewline $file]
	close $file
	if {$data == ""} {
		set files [open $dir "w"]
		close $files
	}
	set file [open $dir "a"]
	puts $file "$who"
	close $file
}

proc recordz:seen {nick uhost hand chan arg} {
	global dir dir1 seen count botnick
	if {![channel get $chan blackseen]} {
		return 0
	}
	set i 0
	set what [lindex [split $arg] 0]
	set number [scan $seen(flood) %\[^:\]]
	set timer [scan $seen(flood) %*\[^:\]:%s]
	foreach tmr [utimers] {
		if {[string match "*count(flood:$uhost:$chan)*" [join [lindex $tmr 1]]]} {
			killutimer [lindex $tmr 2]
		}
	}
	if {![info exists count(flood:$uhost:$chan)]} {
		set count(flood:$uhost:$chan) 0
	}
	incr count(flood:$uhost:$chan)
	utimer $timer [list unset count(flood:$uhost:$chan)]

	if {$count(flood:$uhost:$chan) == "$number"} {
		puthelp "NOTICE $nick :Asteapta 1 minut inainte de a incepe cautarea."
		return 0
	}

	if {[string match -nocase $what $nick]} { puthelp "NOTICE $nick :$nick look in the mirror :)"
		return 0
	}
	if {[onchan $what $chan]} { puthelp "NOTICE $nick :$what is already on $chan :)"
		return 0
	}

	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	if {$database == ""} { puthelp "NOTICE $nick :I dont have any record in my database."
		return 0
	}
	if {![string match -nocase "*!*" "$what"]} {
		set time [unixtime]
		set mask "$nick!$uhost"
		seen:rec $what $chan $time $mask
	}

	set data [split $database "\n"]
	foreach line $data {
		set how [lindex [split $line] 0]
		set userentry [lindex [split $line] 2]
		set chanentry [lindex [split $line] 1]
		set host [lindex [split $line] 3]
		set timer [lindex [split $line] 4]
		set jointime [lindex [split $line] 5]
		set reason [lrange [split $line] 6 end]
		set newnick [lindex [split $line] 6]
		set totalyear [expr [unixtime] - $timer]
		if {$totalyear >= 31536000} {
			set yearsfull [expr $totalyear/31536000]
			set years [expr int($yearsfull)]
			set yearssub [expr 31536000*$years]
			set totalday [expr $totalyear - $yearssub]
		}
		if {$totalyear < 31536000} {
			set totalday $totalyear
			set years 0
		}
		if {$totalday >= 86400} {
			set daysfull [expr $totalday/86400]
			set days [expr int($daysfull)]
			set dayssub [expr 86400*$days]
			set totalhour [expr $totalday - $dayssub]
		}
		if {$totalday < 86400} {
			set totalhour $totalday
			set days 0
		}
		if {$totalhour >= 3600} {
			set hoursfull [expr $totalhour/3600]
			set hours [expr int($hoursfull)]
			set hourssub [expr 3600*$hours]
			set totalmin [expr $totalhour - $hourssub]
		}
		if {$totalhour < 3600} {
			set totalmin $totalhour
			set hours 0
		}
		if {$totalmin >= 60} {
			set minsfull [expr $totalmin/60]
			set mins [expr int($minsfull)]
		}
		if {$totalmin < 60} {
			set mins 0
		}
		if {$years < 1} {set yearstext ""} elseif {$years == 1} {set yearstext "$years year, "} {set yearstext "$years years, "}

		if {$days < 1} {set daystext ""} elseif {$days == 1} {set daystext "$days day, "} {set daystext "$days days, "}

		if {$hours < 1} {set hourstext ""} elseif {$hours == 1} {set hourstext "$hours hour, "} {set hourstext "$hours hours, "}

		if {$mins < 1} {set minstext ""} elseif {$mins == 1} {set minstext "$mins minute"} {set minstext "$mins minutes"}

		set output $yearstext$daystext$hourstext$minstext

		if {$totalyear < 60} {
			set output "$totalyear seconds"
		}
		set staytime [expr [unixtime] - $jointime]
		set stayt [expr $timer - $jointime]
		if {$stayt >= 31536000} {
			set yearsfull [expr $stayt/31536000]
			set years [expr int($yearsfull)]
			set yearssub [expr 31536000*$years]
			set totalday [expr $stayt - $yearssub]
		}
		if {$stayt < 31536000} {
			set totalday $stayt
			set years 0
		}
		if {$totalday >= 86400} {
			set daysfull [expr $totalday/86400]
			set days [expr int($daysfull)]
			set dayssub [expr 86400*$days]
			set totalhour [expr $totalday - $dayssub]
		}
		if {$totalday < 86400} {
			set totalhour $totalday
			set days 0
		}
		if {$totalhour >= 3600} {
			set hoursfull [expr $totalhour/3600]
			set hours [expr int($hoursfull)]
			set hourssub [expr 3600*$hours]
			set totalmin [expr $totalhour - $hourssub]
		}
		if {$totalhour < 3600} {
			set totalmin $totalhour
			set hours 0
		}
		if {$totalmin >= 60} {
			set minsfull [expr $totalmin/60]
			set mins [expr int($minsfull)]
		}
		if {$totalmin < 60} {
			set mins 0
		}
		if {$years < 1} {set yearstext ""} elseif {$years == 1} {set yearstext "$years year, "} {set yearstext "$years years, "}

		if {$days < 1} {set daystext ""} elseif {$days == 1} {set daystext "$days day, "} {set daystext "$days days, "}

		if {$hours < 1} {set hourstext ""} elseif {$hours == 1} {set hourstext "$hours hour, "} {set hourstext "$hours hours, "}

		if {$mins < 1} {set minstext ""} elseif {$mins == 1} {set minstext "$mins minute"} {set minstext "$mins minutes"}

		set staytime $yearstext$daystext$hourstext$minstext

		if {$stayt < 60} {
			set staytime "$stayt seconds"
		}
		set date  [clock format $timer -format %d.%m.]
		set hour  [clock format $timer -format %H:%M]
		if {$jointime == "0"} { set staymsg "I dont know how much he stayed."
		} else { set staymsg "after he stayed $staytime on $chan."}
		if {[string equal -nocase $userentry $what] && [string match -nocase $chanentry $chan]} {
			set host [string trim $host "*!~"]
			set i [expr $i +1]
			if {$i < 6} {
				lappend entry $userentry
			}
			set seenfound 1

			if {[lindex [split $line] 0] == "PART"} {
				set reply "[join $entry ","] ($host) left $chan about $output ($date $hour) stating: $reason, $staymsg"
			}
			if {[lindex [split $line] 0] == "SIGN"} {
				set reply "[join $entry ","] ($host) left IRC about $output ($date $hour) stating: $reason, $staymsg"
			}
			if {[lindex [split $line] 0] == "JOIN"} {
				if {[onchan $what $chan]} { set nowon "$what is stil here."} else { set nowon "I dont see $what on $chan" }
				set reply "[join $entry ","] ($host) joined $chan about $output ($date $hour).$nowon"
			}
			if {[lindex [split $line] 0] == "SPLIT"} {
				set reply "[join $entry ","] ($host) left in *.net *.split about $output ($date $hour), $staymsg"
			}
			if {[lindex [split $line] 0] == "KICK"} {
				set reply "[join $entry ","] ($host) was kicked on $chan about $output ($date $hour) with the reason ($reason), $staymsg"
			}
			if {[lindex [split $line] 0] == "NICKCHANGE"} {
				if {[onchan $newnick $chan]} { set nowon "$newnick is stil here." } else { set nowon "I dont see $newnick on $chan" }
				set reply "[join $entry ","] ($host) changed his NICK in $newnick about $output ($date $hour).$nowon"
			}
		}
		if {$what == "*!*@*"} { return 0 }
		if {[string match -nocase $what $host] && [string match -nocase $chanentry $chan]} {
			set host [string trim $host "*!~"]
			set i [expr $i +1]
			if {$i < 6} {
				lappend entry $userentry
			}

			set seenfound 1
			if {[lindex [split $line] 0] == "PART"} {
				set reply "[join $entry ","] ($host) left $chan about $output ($date $hour) stating: $reason, $staymsg"
			}
			if {[lindex [split $line] 0] == "SIGN"} {
				set reply "[join $entry ","] ($host) left IRC about $output ($date $hour) stating: $reason, $staymsg"
			}
			if {[lindex [split $line] 0] == "JOIN"} {
				if {[onchan $userentry $chan]} { set nowon "$userentry is stil here."} else { set nowon "I dont see $userentry on $chan" }
				set reply "[join $entry ","] ($host) joined $chan about $output ($date $hour).$nowon"
			}
			if {[lindex [split $line] 0] == "SPLIT"} {
				set reply "[join $entry ","] ($host) left in *.net *.split about $output ($date $hour), $staymsg"
			}
			if {[lindex [split $line] 0] == "KICK"} {
				set reply "[join $entry ","] ($host) was kicked on $chan about $output ($date $hour) with the reason ($reason), $staymsg"
			}
			if {[lindex [split $line] 0] == "NICKCHANGE"} {
				if {[onchan $newnick $chan]} { set nowon "$newnick is stil here." } else { set nowon "I dont see $newnick on $chan" }
				set reply "[join $entry ","] ($host) changed his NICK in $newnick about $output ($date $hour).$nowon"
			}
		}

	}
	if {[info exists reply]} {
		if {$seen(how) == "1"} {
			puthelp "NOTICE $nick :$reply"
		} else { puthelp "PRIVMSG $chan :$reply"
		}
	}

	if {![info exists seenfound]} {
		puthelp "NOTICE $nick :I dont remember $what."
	}
}

proc seen:rec {nick chan time who} {
	global dir1
	set lin 0
	set w "$nick $chan $time $who"
	if {[isbotnick $nick]} { return 0 }
	set filez [open $dir1 "r"]
	set databases [read -nonewline $filez]
	close $filez
	set datas [split $databases "\n"]
	foreach line $datas {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 0]
		set chanentry [lindex [split $line] 1]
		set inculpat [lindex [split $line] 3]
		if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
			set w "$nick $chan $time $who"
			if {![string match -nocase $inculpat $who]} {
				lappend wer $inculpat $who
				set w "$nick $chan $time [join $wer " , "]"
			}

			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $datas $num $num]
				set files [open $dir1 "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}

	}
	set filez [open $dir1 "r"]
	set datas [read -nonewline $filez]
	close $filez
	if {$datas == ""} {
		set files [open $dir1 "w"]
		close $files
	}
	set filez [open $dir1 "a"]
	puts $filez "$w"
	close $filez
}

proc record:seened {nick host hand chan} {
	global dir1
	if {![channel get $chan blackseen]} {
		return 0
	}
	set lin 0
	set filez [open $dir1 "r"]
	set databases [read -nonewline $filez]
	close $filez
	set datas [split $databases "\n"]
	foreach line $datas {
		set lin [expr $lin +1]
		set userentry [lindex [split $line] 0]
		set chanentry [lindex [split $line] 1]
		if {[string equal -nocase $userentry $nick] && [string match -nocase $chanentry $chan]} {
			set time [lindex [split $line] 2]
			set date  [clock format $time -format %d.%m.]
			set hour  [clock format $time -format %H:%M]
			set totalyear [expr [unixtime] - $time]
			if {$totalyear >= 31536000} {
				set yearsfull [expr $totalyear/31536000]
				set years [expr int($yearsfull)]
				set yearssub [expr 31536000*$years]
				set totalday [expr $totalyear - $yearssub]
			}
			if {$totalyear < 31536000} {
				set totalday $totalyear
				set years 0
			}
			if {$totalday >= 86400} {
				set daysfull [expr $totalday/86400]
				set days [expr int($daysfull)]
				set dayssub [expr 86400*$days]
				set totalhour [expr $totalday - $dayssub]
			}
			if {$totalday < 86400} {
				set totalhour $totalday
				set days 0
			}
			if {$totalhour >= 3600} {
				set hoursfull [expr $totalhour/3600]
				set hours [expr int($hoursfull)]
				set hourssub [expr 3600*$hours]
				set totalmin [expr $totalhour - $hourssub]
			}
			if {$totalhour < 3600} {
				set totalmin $totalhour
				set hours 0
			}
			if {$totalmin >= 60} {
				set minsfull [expr $totalmin/60]
				set mins [expr int($minsfull)]
			}
			if {$totalmin < 60} {
				set mins 0
			}
			if {$years < 1} {set yearstext ""} elseif {$years == 1} {set yearstext "$years an, "} {set yearstext "$years ani, "}

			if {$days < 1} {set daystext ""} elseif {$days == 1} {set daystext "$days zi, "} {set daystext "$days zile, "}

			if {$hours < 1} {set hourstext ""} elseif {$hours == 1} {set hourstext "$hours ora, "} {set hourstext "$hours ore, "}

			if {$mins < 1} {set minstext ""} elseif {$mins == 1} {set minstext "$mins minut"} {set minstext "$mins minute"}

			set howmuch $yearstext$daystext$hourstext$minstext

			if {$totalyear < 60} {
				set howmuch "$totalyear secunde"
			}

			set bywho [lrange [split $line] 3 end]
			puthelp "NOTICE $nick :$bywho looked for you with !seen on $chan about $howmuch ($date $hour)."
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $datas $num $num]
				set files [open $dir1 "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
}

proc record:expire {} {
	global dir seen
	putlog "(BlackSeen) Checking informations..."
	set curtime [unixtime]
	set lin 0
	set countlin 0
	set day 86400
	set file [open $dir "r"]
	set database [read -nonewline $file]
	close $file
	set data [split $database "\n"]
	foreach line $data {
		set lin [expr $lin +1]
		set lastseen [lindex [split $line] 4]
		set limitseen [expr ($curtime - $lastseen)/$day]
		if {$limitseen > $seen(limittime)} {
			set countlin [expr $countlin +1]
			if {$line != ""} {
				set num [expr $lin - 1]
				set delete [lreplace $data $num $num]
				set files [open $dir "w"]
				puts $files [join $delete "\n"]
				close $files
			}
		}
	}
	putlog "(BlackSeen) Found $countlin expired information."
	timer [expr $seen(verifytime) * 60] record:expire
	return 1
}


putlog "BlackSeen 1.3 by BLaCkShaDoW Loaded"
This is the latest version of this script you better try this one.
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

Post by janii »

same error in new version as well its sumthin to do with eggdrop1.6.21
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Check out:
http://www.egghelp.org/files.htm#patches
For Eggdrop 1.6.21

timerworkaround.patch.gz by thommey New 25/5/12
Resolves a bug in Eggdrop 1.6.21's utimers command which could cause Tcl scripts not to function correctly, ....
http://forum.egghelp.org/viewtopic.php?t=18760


and decide if you think that might help.
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

Post by janii »

well thnx for replies but m already using eggdrop1.6.21 with the patch u suggested .. so need sum1 else to help me on tht seen tcl n eggdrop1.6.21 ty
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Hmmm, looks like another sign the 1.6.21 egg doesn't always play well with the older sripts:)
Maybe you would be willing to just back up and run this script on the more script friendly 1.6.20 bot?

If not, try to get us some better error info to work with...
From the forum string: http://forum.egghelp.org/viewtopic.php?t=10215
have your .tcl and .set commands enabled, meaning that you need to open your config and comment out (or remove) the following lines:
unbind dcc n tcl *dcc:tcl
unbind dcc n set *dcc:set
then save config and restart the bot

have full backtrace of the error; that means upon receiving Tcl error (you must be logged in), immediately type .set errorInfo and save the output

if the bot replies with `What? You need .help', you need to enable command .set (see above)
Paste that returned error info here, so maybe we can see a little of what's going on when the error happens.
That is a very long proc, with some fairly odd/interresting math going on.

Since we now have 2 versions of the script posted on this forum string, which of these are you currently trying to run?
Need to make sure we are both working with the same script:)
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Post Reply