## File GET v1.2 ## By mamaKIN (mamakin@mailandnews.com) ## Released [12-05-1999] ## ### Important Notes: ############################ ## ## You need to have the transfer module loaded for this to work ## ### Installation: ############################### ## ## 1) Put this file in your script directory ## 2) Add the line "source /fget.tcl" to your bots configuration ## 3) Rehash your bot if it is already running or start it up if it is not ## ### Usage: ###################################### ## ## Channel Commands: ## !get - Sends the first matching file to you ## !send - Sends the first matching file to the nickname ## ################################################# ## SETTINGS ##################################### # Where is your file directory? set get_dir "/home/trouble/Desktop/eggdrop/testing" # Which files/directories should I not search for/in? set get_nfile "incoming readme.txt" # Which channels shall the commands work on? set get_chans "#adultsexxxmovies #FileSearch" ############################################################### ## Do not edit below here unless you know what you are doing ## ############################################################### bind pub - !get GET:pub_get bind pub +v|+v !send GET:pub_send2 proc filesearch {file dir} { set file [string tolower $file] return [searchdat $file $dir] } proc searchdat {file dir} { if {[string range $dir end end] != "/"} { append dir "/" } set r "" set l [glob -nocomplain $dir*] foreach f $l { if {[file isdirectory $f]} { set r [concat $r [searchdat $file $f]] } elseif {[file isfile $f]} { if {[string tolower [file tail $f]] == $file} { lappend r $f } } } return $r } proc chncheck {chan check} { foreach c $check { if {$chan == $c} { return 1 } } return 0 } proc GET:pub_get {nick host hand chan text} { global get_dir get_chans get_nfile if {[chncheck $chan $get_chans]} { set file [lindex $text 0] if {![string match "*[string tolower $file]*" "[string tolower [lrange $get_nfile 0 end]]"]} { set results [filesearch $file $get_dir] } { puthelp "NOTICE $nick :Could not send you $file, because the file has been disabled." return 1 } if {[llength $results] == 0} { puthelp "NOTICE $nick :Didn't find any results for $file" } { set sent [dccsend [lindex $results 0] $nick] if {$sent == 0} { puthelp "NOTICE $nick :Sending you $file" } elseif {$sent == 1} { puthelp "NOTICE $nick :DCC Tables are full. Try back in a few minutes." } elseif {$sent == 2} { puthelp "NOTICE $nick :For some strange reason the file does not exist." } elseif {$sent == 4} { puthelp "NOTICE $nick :Your file was queued for a later transfer." } else { puthelp "NOTICE $nick :An undefined error occurred during the transfer." } } } return 1 } proc GET:pub_send2 {nick host hand chan text} { global get_dir get_chans get_nfile if {[chncheck $chan $get_chans]} { set g2nick [lindex $text 0] set file [lindex $text 1] if {![string match "*[string tolower $file]*" "[string tolower [lrange $get_nfile 0 end]]"]} { set results [filesearch $file $get_dir] } { puthelp "NOTICE $nick :Could not send you $file, because the file has been disabled." return 1 } if {[llength $results] == 0} { puthelp "NOTICE $nick :Didn't find any results for $file" } else { set sent [dccsend [lindex $results 0] $g2nick] puthelp "NOTICE $g2nick :$nick requested for me to send you $file" if {$sent == 0} { puthelp "NOTICE $nick :Sending $g2nick $file" puthelp "NOTICE $g2nick :Sending you $file" } elseif {$sent == 1} { puthelp "NOTICE $g2nick :DCC Tables are full. You cannot receive the file." puthelp "NOTICE $nick :DCC Tables are full. Could not send $g2nick $file" } elseif {$sent == 2} { puthelp "NOTICE $g2nick :For some strange reason the file does not exist." putserv "NOTICE $nick :The file does not exist." } elseif {$sent == 3} { puthelp "NOTICE $nick :Had trouble connecting to $g2nick" } elseif {$sent == 4} { puthelp "NOTICE $g2nick :Your file was queued for a later transfer." puthelp "NOTICE $nick :$file was queued and will be transfered later." } else { puthelp "PRIVMSG $nick :An undefined error occurred during the transfer." } } } return 1 } putlog "Loaded \002File GET v1.2\002 by mamaKIN"