# Set your channel here so the bot can msg it set yourchan "#somedays" # leave this alone this is needed to .chanset #channel +torrent setudef flag torrent # Set the torrent db and templist here set torrent_db "torrentlist.txt" set torrent_temp "templist.txt" # Dcc Chat commands bind dcc p checktemp dcc_torrent_check_temp bind dcc p shitsite dcc_torrent_shit_site # Public bind commands bind pub - !dlist torrent_dlist bind pub - !info torrent_info bind pub - !stats torrent_stats bind pub - !thelp torrent_help # Msg bot commands bind msg - !post torrent_add proc torrent_add {nick host hand arg} { global site torrent_temp yourchan 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 $yourchan :New torrent site in the templist, by $nick, An admin will check it soon." addtemp } proc addtemp {} { global file linecount site torrent_temp set addtemp_file [open $torrent_temp w] puts $addtemp_file "[linecount] Site: $site" close $addtemp_file return 0 } proc torrent_info {nick host hand chan text} { global torrent_db botnick site if {[ischanset $chan "+torrent"]} { set info_find [lrange [split $text] 0 end] set info_id [open $torrent_db r] set info_data [read $info_id] set info_data1 [string tolower [split $info_data "\n"]] set info_data2 [lsearch -inline -all $info_data1 *$info_find*] if {$info_data2 == ""} { putserv "NOTICE $nick :Sorry nothing was found!" return } set info_data3 [lindex $info_data2 [rand [llength $info_data2]]] set info_results [split $info_data3] close $info_id putserv "NOTICE $nick :$info_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." } } proc dcc_torrent_templist {args} { global checktemp torrent_temp l yourchan checktemp foreach l [checktemp $torrent_temp] { putlog "$l" putserv "PRIVMSG $yourchan :An admin is checking the templist, please hold while the sites are being checked then added." } } proc dcc_torrent_check_temp {args} { global checktemp torrent_temp l yourchan checktemp foreach l [checktemp $torrent_temp] { putlog "$l" putserv "PRIVMSG $yourchan :An admin is checking the templist, please hold while the sites are being checked then added." } } proc checktemp {args} { global torrent_temp set file [open "$torrent_temp" r] set data [read -nonewline $file] close $file return "[split $data \n]" } proc dcc_torrent_shit_site {hand idx arg} { global lines num line_to_delete torrent_temp set num [lindex $arg 0] set temp_open [open $torrent_temp "w"] set line_to_delete $num set lines [split $fp "\n"] puts $fp [join $lines "\n"] close $fp } ##### counters ##### set linecount 0 proc linecount {} { incr ::linecount }