Excuse my bad English.
Code: Select all
############################################
# Search for packs for the #eBOOKs channel #
############################################
on *:START:{ hmake xdccs 2000 }
on *:TEXT:$(* $+ $chr(35) $+ *):#eBOOKs:{
if ($nick isvoice $chan) || ($nick ishop $chan) || ($nick isop $chan) {
if ($xdccs.pack($1-)) { xdccs.add $nick $ifmatch }
}
}
alias xdccs.pack {
tokenize 32 $strip($1-)
var %xdccs.pack.format = #* *x [*] *
if (%xdccs.pack.format iswm $1-) {
if ([*] iswm $3) { tokenize 32 $remove($1,$chr(35)) $remove($2,$chr(120)) $remove($3,$chr(91),$chr(93)) $4- }
if ([ *] iswm $3-4) { tokenize 32 $remove($1,$chr(35)) $remove($2,$chr(120)) $remove($3-4,$chr(32),$chr(91),$chr(93)) $5- }
return $1-
}
var %xdccs.pack.format = #* «*» * - (* gets)
if (%xdccs.pack.format iswm $1-) {
if («*» iswm $2) { tokenize 32 $remove($1,$chr(35)) N/A $remove($2,$chr(171),$chr(187)) $3- }
if («*» iswm $2-3) { tokenize 32 $remove($1,$chr(35)) N/A $remove($2-3,$chr(171),$chr(187)) $4- }
return $1-
}
}
alias xdccs.add {
if ($5) {
hadd xdccs $1 $+ _ $+ $2 $ctime $3-
if ($xdccs.top($3)) { top.add $1 $+ _ $+ $2 }
}
}
################################
## !total: show total searches #
################################
##################################################
# can you show !total every hour on the channel? #
##################################################
on *:TEXT:!total:*:{ .msg # 04[15 Searchbot7™ 04][14 total searches12:14 %search.tot 04][14 successful searches12:14 $round($calc($calc(%search.suc / %search.tot) * 100),2) $+ $chr(37) 04][14 total packs12:14 $hget(xdccs,0).item 04] }
######################################
# !search - !s : show search results #
######################################
on *:TEXT:!search *:*:{
inc %search.tot
var %xdccs.search.str = * $+ $replace($2-,$chr(32),$chr(42)) $+ *
var %xdccs.search.cur = 1
var %xdccs.search.packs = 0
while ($hget(xdccs,%xdccs.search.cur).item) {
var %xdccs.search.value = $gettok($hget(xdccs,$ifmatch),3-,32)
if (%xdccs.search.str iswm %xdccs.search.value) { inc %xdccs.search.packs }
inc %xdccs.search.cur
}
if (%xdccs.search.packs == 0) { .notice $nick 04[14 Searchbot7™ 04] [14 Sorry12,14 No Matches For12:14 $2- $+ 12. 04][14 Total Packs12:14 $hget(xdccs,0).item $+ 12. 04] }
if (%xdccs.search.packs != 0) {
inc %search.suc
.notice $nick 04[14 Searchbot7™ 04] [14 $iif(%xdccs.search.packs > 9,10, %xdccs.search.packs) $+ 12/14 $+ %xdccs.search.packs Results For12:14 $2- $+ 12. 04][14 Total Packs12:14 $hget(xdccs,0).item $+ 12. 04]
var %xdccs.disp.cur = 1
var %xdccs.disp.packs = 0
while ($hget(xdccs,%xdccs.disp.cur).item) {
var %xdccs.disp.value = $gettok($hget(xdccs,$ifmatch),4-,32)
var %xdccs.disp.gets = $gettok($hget(xdccs,$ifmatch),2,32)
var %xdccs.disp.size = $gettok($hget(xdccs,$ifmatch),3,32)
var %xdccs.disp.time = $duration($calc($ctime - $gettok($hget(xdccs,$ifmatch),1,32)))
var %xdccs.disp.name = $gettok($ifmatch,1,95)
var %xdccs.disp.pack = $gettok($ifmatch,2,95)
if (%xdccs.search.str iswm %xdccs.disp.value) {
.notice $nick $iif(%xdccs.disp.name ison #eBOOKs,04[9 ONLiNE 04],04[4 OFFLiNE 04]) 04[14 %xdccs.disp.value 04][14 Size9:14 %xdccs.disp.size 04][14 Gets12:14 %xdccs.disp.gets 04][14 Command12:14 /msg %xdccs.disp.name xdcc send $chr(35) $+ %xdccs.disp.pack 04]
inc %xdccs.disp.packs
}
if (%xdccs.disp.packs == 20) { halt }
inc %xdccs.disp.cur
}
}
.notice $nick [ If you do not find what you are looking for, be more specific in your search, Enjoy!!! ]
.notice $nick [ === End Of Search === ]
}