Snippets Project Page
Author: entropy
Added: 4y ago
Updated: 2y ago
mIRC: 7.52+
Hits: 2,632
Downloads: 76
Review By: entropy
Size: 5.91KB
4
0
Login to vote.
Simple Seen v1.8
This snippet stores data for each nick and returns it with the !seen command.
Download
JSON
▼ Review
▲ Source
; Simple Seen v1.8 - by entropy 2020 ; Usage: !seen <nick> on *:start:{ .timerseen -o 0 300 saveall } on *:exit:{ saveall } on *:disconnect:{ if ($hget($+(seen.,$network))) { hsave -o $+(seen.,$network) $qt($+($scriptdir,seen.,$network,.dat)) | hfree $+(seen.,$network) } } on *:connect:{ if (!$hget($+(seen.,$network))) { hmake $+(seen.,$network) 100 } if ($exists($qt($+($scriptdir,seen.,$network,.dat)))) { hload $+(seen.,$network) $qt($+($scriptdir,seen.,$network,.dat)) } } alias -l saveall { var %a = 1, %b | while ($scon(%a)) { %b = $v1 | scid %b | if ($hget($+(seen.,$network))) { hsave -o $+(seen.,$network) $qt($+($scriptdir,seen.,$network,.dat)) } | inc %a } } alias -l clearall { var %a = 1, %b | while ($scon(%a)) { %b = $v1 | scid %b | if ($hget($+(seen.,$network))) { hfree $+(seen.,$network) | hmake $+(seen.,$network) 100 } | inc %a } } #seen on on *:text:*:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Messaging # with text: $qt($1-) if (?seen iswm $1 && $left($1,1) isin @!.) { if (!$2) { msg # No "seen" nickname specified! } else { seenx # $2 $1- } } } on *:input:#:{ if ($server && /* !iswm $1) { hadd -m $+(seen.,$network) $address($me,5) $ctime Messaging # with text: $qt($1-) } if (?seen iswm $1 && $left($1,1) isin @!.) { if (!$2) { msg # No "seen" nickname specified! } else { seenx # $2 $1- } } } on *:action:*:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Actioning # with text: $qt($1-) } on *:join:#:{ if ($nick == $me) { .ialfill # } | hadd -m $+(seen.,$network) $fulladdress $ctime Joining # } on *:part:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Parting # with text: $qt($1-) } on *:rawmode:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Setting # mode(s) to: $qt($1-) } on *:kick:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Kicking $knick out of # with text: $qt($1-) } on *:quit:{ hadd -m $+(seen.,$network) $fulladdress $ctime Quitting IRC with text: $qt($1-) } on *:topic:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Setting # topic to: $qt($1-) } on *:nick:{ hadd -m $+(seen.,$network) $fulladdress $ctime Changing nickname to: $newnick } alias -l seenx { var %all, %host if ($gettok($address($2,5),2,33)) { %host = $+($2,!,$v1) } else { %host = $+($2,!*) } if (* isin $2) { %all = $hfind($+(seen.,$network),$2,1,w).item | var %nick = $gettok(%all,1,33) } else { %all = $hfind( $+(seen.,$network) , %host , 1 , w).item | var %nick = $gettok(%all,1,33) } if ($2 == $me) { msg $1 I'm right here! | return } var %a = $2 var %b = $hget($+(seen.,$network),%a) var %q = $hfind($+(seen.,$network),%a,1).item var %time = $asctime($gettok($hget($+(seen.,$network),%all),1,32)) var %nt = $gettok($hget($+(seen.,$network),%all),1,32) var %dur = $calc($ctime - %nt) var %dur = $remove($replace($duration(%dur),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)) ago var %rsn = $gettok($hget($+(seen.,$network),%all),2-,32) var %no = $gettok(%all,2,33) var %mo = $gettok($gettok(%b,1,32),2,33) var %r = $gettok($hfind($+(seen.,$network),%a,1,w).item,1,33) if (* isin $2) { var %total = $hfind($+(seen.,$network),$2,0,w).item if (%total >= 5) { msg $1 [Seen] $chr(9679) $qt($2) has $bytes(%total,b) $iif(%total == 1,result!,results!) Please refine your search and try again! } elseif (%total != 1) { var %c = 1, %d, %all while ($hfind($+(seen.,$network),$2,%c,w).item) { %d = $v1 %all = %all %d inc %c } if ($numtok(%all,32) >= 5) { %all = $gettok(%all,1-5,32) $+ ... } if ($numtok(%all,32) != 0) { msg $1 [Seen] $chr(9679) Found $bytes($numtok(%all,32),b) $iif($numtok(%all,32) == 1,Result:,Results:) $replace(%all,$chr(32),$+($chr(44),$chr(32))) } else { msg $1 [Seen] $chr(9679) No results found! } } elseif ($hfind($+(seen.,$network),$2,1,w).item) { var %all = $hfind($+(seen.,$network),$2,1,w).item var %a = %all var %b = $hget($+(seen.,$network),%all) var %q = $gettok(%all,1,33) var %time = $asctime($gettok($hget($+(seen.,$network),%a),1,32)) var %nt = $gettok($hget($+(seen.,$network),%a),1,32) var %dur = $calc($ctime - %nt) var %dur = $remove($replace($duration(%dur),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)) ago var %rsn = $gettok($hget($+(seen.,$network),%a),2-,32) var %no = $gettok(%a,1,33) var %mo = %all msg $1 [Seen] $chr(9679) I Last Saw $qt(%q) $iif(%mo,$+($chr(40),$gettok(%mo,2,33),$chr(41))) %time $+($chr(40),%dur,$chr(41)) - %rsn } else { msg $1 [Seen] $chr(9679) I have not seen that person. } } elseif (%all) { var %c = 1, %d, %e, %elapsed, %found while ($hfind($+(seen.,$network),$+($2,!*),%c,w).item) { %d = $v1 %e = $gettok($hget($+(seen.,$network),%d),1,32) if (%e >= %elapsed || !%elapsed) { %found = %d $hget($+(seen.,$network),%d) %elapsed = %e } inc %c } if (%found) { var %nick = $gettok(%found,1,33) var %c = $gettok(%found,1,32) var %d = $gettok(%found,2-,32) var %time = $asctime($gettok(%found,2,32)) var %dur = $calc($ctime - $gettok(%found,2,32)) var %dur = $remove($replace($duration(%dur),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)) ago var %rsn = $gettok(%d,2-,32) msg $1 [Seen] $chr(9679) I Last Saw $qt(%nick) $+($chr(40),$gettok(%c,2,33),$chr(41)) %time $+($chr(40),%dur,$chr(41)) - %rsn } } else { msg $1 [Seen] $chr(9679) I have not seen that person. } } #seen end
Changelog:
0
0
Comments (2)