setudef flag torrent set torrent_db "tlist.db" set torrent_temp "templist.db" bind pub - !tadd torrent_add bind pub - !thelp torrent_help bind pub - !info torrent_info bind pub - !stats torrent_stats proc torrent_add {nick host hand chan arg} { global site torrent_temp if {[ischanset $chan "+torrent"]} { set site [lindex $arg 0] putserv "NOTICE $nick :$nick The torrent site has been added to the templist, please wait untell an admin checks it." putserv "PRIVMSG $chan :New torrent site in the templist, an admin will check it soon." addtemp } } proc addtemp {} { global torrent_temp file site set file [open $torrent_temp a] puts $file "Site: $site" close $file return 0 } proc torrent_help {hand uhost nick chan arg} { if {[ischanset $chan "+torrent"]} { putserv "PRIVMSG $chan :To add a torrent site type: !tadd site ." } } proc torrent_info {nick host hand chan text} { global torrent_db botnick site set find [lrange [split $text] 0 end] set fid [open $torrent_db r] set data [read $fid] set data1 [string tolower [split $data "\n"]] set data2 [lsearch -inline -all $data1 *$find*] if {$data2 == ""} { putserv "NOTICE $nick : Sorry nothing was found!" return } set data3 [lindex $data2 [rand [llength $data2]]] set results [split $data3] close $fid putserv "PRIVMSG $chan :$results" } proc torrent_stats {nick host hand chan text} { global torrent_db if {[ischanset $chan "+torrent"]} { set linecount 0 set input [open $torrent_db r] set lines [split [read $input] \n] catch {close $input} foreach line $lines { incr linecount } puthelp "PRIVMSG $chan :i have toldel of $linecount Torrent sites in my database." } }