home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HaCKeRz KrOnIcKLeZ 3
/
HaCKeRz_KrOnIcKLeZ.iso
/
scriptz
/
floyd_se.tcl
< prev
next >
Wrap
Text File
|
1996-04-23
|
9KB
|
287 lines
#
# simple implementation of the 'seen' command for eggdrop
# by Robey, 19mar95
# v2 4may95
# v3 eden 29sep95 - won't show seen if tandem-bot is on channel to do it
# v4 cmwagner@gate.net 25jan96 - msg/dcc interface instead of public,
# tandem-nick removed, since it is now a
# private interface, instead of public
# v4.1 cmwagner@gate.net 26mar96 - modified for eggdrop1.0
# v4.2 cmwagner@gate.net 26mar96 - ok, actually works now, I think. <grin>
# v4.3 floydman@netaxs.com 29mar96 - added public access to seen.
# v4.4 floydman@netaxs.com 7apr96 - Changed the format of the reply from
# the bot...to give No. of years, days,
# hours, and minutes since somebody was
# last on.
bind pub - !seen pub_seen
bind msg - seen msg_seen
bind dcc - seen cmd_seen
proc pub_seen {nick uhost hand channel args} {
global botnick
set who [string trim [lindex $args 0] ?]
if {[string compare [string tolower $botnick] [string tolower $who]] == 0} {
putchan $channel "$nick :Yeah, whenever I look in a mirror..."
return 1
}
if {[string compare [string tolower $nick] [string tolower $who]] == 0} {
putchan $channel "$nick :Trying to find yourself, eh?"
return 1
}
foreach j [channels] {
if {[onchansplit $who $j]} {
putchan $channel "$nick :$who was just on $j, but got netsplit"
return 1
}
if {[onchan $who $j]} {
putchan $channel "$nick :$who is on $j right now"
return 1
}
foreach i [chanlist $j] {
set hand [finduser $i![getchanhost $i $j]]
if {($hand != "*") && ([string compare [string tolower $hand] [string tolower $who]] == 0)} {
if {[onchansplit $i $j]} {
putchan $channel "$nick :$i is $who, and $i was just on $j but got net-split"
} {
if {[onchan $i $j]} {
putchan $channel "$nick :$i is $who, and $i is on $j right now!"
}
}
return 1
}
}
}
if {[validuser $who]} {
set lasttime [getlaston $who]
if {$lasttime == 0} {
putchan $channel "$nick :$who has never been here."
return 1
}
set totalyear [expr [unixtime] - $lasttime]
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} {
putchan $channel "$nick :$who left $channel less then a minute ago."
return 1
}
if {$years < 1} then {set yearstext ""} else {set yearstext "$years years, "}
if {$days < 1} then {set daystext ""} else {set daystext "$days days, "}
if {$hours < 1} then {set hourstext ""} else {set hourstext "$hours hours, "}
putchan $channel "$nick :$who was last here $yearstext$daystext$hourstext$mins minutes ago"
return 1
}
putchan $channel "$nick :I don't know who $who is."
}
proc msg_seen {nick uhost hand args} {
global botnick
set who [string trim [lindex $args 0] ?]
if {[string compare [string tolower $botnick] [string tolower $who]] == 0} {
putserv "PRIVMSG $nick :Yeah, whenever I look in a mirror..."
return 1
}
if {[string compare [string tolower $nick] [string tolower $who]] == 0} {
putserv "PRIVMSG $nick :Trying to find yourself, eh?"
return 1
}
foreach j [channels] {
if {[onchansplit $who $j]} {
putserv "PRIVMSG $nick :$who was just on $j, but got netsplit"
return 1
}
if {[onchan $who $j]} {
putserv "PRIVMSG $nick :$who is on $j right now!"
return 1
}
foreach i [chanlist $j] {
set hand [finduser $i![getchanhost $i $j]]
if {($hand != "*") && ([string compare [string tolower $hand] [string tolower $who]] == 0)} {
if {[onchansplit $i $j]} {
putserv "PRIVMSG $nick :$i is $who, and $i was just on $j but got net-split"
} {
if {[onchan $i $j]} {
putserv "PRIVMSG $nick :$i is $who, and $i is on $j right now!"
}
}
return 1
}
}
}
if {[validuser $who]} {
set lasttime [getlaston $who]
if {$lasttime == 0} {
putserv "PRIVMSG $nick :$who has never been here."
return 1
}
set totalyear [expr [unixtime] - $lasttime]
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} {
putchan $channel "$nick :$who left $channel less then a minute ago."
return 1
}
if {$years < 1} then {set yearstext ""} else {set yearstext "$years years, "}
if {$days < 1} then {set daystext ""} else {set daystext "$days days, "}
if {$hours < 1} then {set hourstext ""} else {set hourstext "$hours hours, "}
putserv "PRIVMSG $nick :$who was last here $yearstext$daystext$hourstext$mins minutes ago"
return 1
}
putserv "PRIVMSG $nick :I don't know who $who is."
}
proc cmd_seen {hand idx args} {
global botnick
set who [string trim [lindex $args 0] ?]
if {[string compare [string tolower $botnick] [string tolower $who]] == 0} {
putdcc $idx "Yeah, whenever I look in a mirror..."
return 1
}
# if {[string compare [string tolower [idx2hand $idx]] [string tolower $who]] == 0} {
# putdcc $idx "Trying to find yourself, eh?"
# return 1
# }
foreach j [channels] {
if {[onchansplit $who $j]} {
putdcc $idx "$who was just on $j, but got netsplit"
return 1
}
if {[onchan $who $j]} {
putdcc $idx "$who is on $j right now!"
return 1
}
foreach i [chanlist $j] {
set hand [finduser $i![getchanhost $i $j]]
if {($hand != "*") && ([string compare [string tolower $hand] [string tolower $who]] == 0)} {
if {[onchansplit $i $j]} {
putdcc $idx "$i is $who, and $i was just on $j but got net-split"
} {
if {[onchan $i $j]} {
putdcc $idx "$i is $who, and $i is on $j right now!"
}
}
return 1
}
}
}
if {[validuser $who]} {
set lasttime [getlaston $who]
if {$lasttime == 0} {
putdcc $idx "$who has never been here."
return 1
}
set totalyear [expr [unixtime] - $lasttime]
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} {
putdcc $idx "$who left $channel less then a minute ago."
return 1
}
if {$years < 1} then {set yearstext ""} else {set yearstext "$years years, "}
if {$days < 1} then {set daystext ""} else {set daystext "$days days, "}
if {$hours < 1} then {set hourstext ""} else {set hourstext "$hours hours, "}
putdcc $idx "$who was last here $yearstext$daystext$hourstext$mins minutes ago"
return 1
}
putdcc $idx "I don't know who $who is."
}