This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Searching File

Support & discussion of released scripts, and announcements of new releases.
Post Reply
h
haferbrei
Voice
Posts: 23
Joined: Wed Apr 08, 2020 8:57 pm

Searching File

Post by haferbrei »

Is there a script where eggdrop looks for a file in a directory?
Something like !search Name
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

haferbrei, tried looking in the TclArchive ?

If not, i'll point you to the right direction.

http://tclarchive.org/search.php?Server

try looking through that 8)
ComputerTech
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: Searching File

Post by willyw »

haferbrei wrote:Is there a script where eggdrop looks for a file in a directory?
Something like !search Name
This is VERY rudimentary. There ought to be lots of things that can be done, to improve it. It just depends on what you are trying to do.

Code: Select all

# November 11, 2020
#
# http://forum.egghelp.org/viewtopic.php?p=109154&sid=af6ef787512bdf9d5d1f0ea3be3949e7#109154
#
##############


bind pub n "!search" filesearch



###
proc filesearch {nick uhost handle chan text} {

        if {![llength [split $text]]} {
                putserv "privmsg $chan :Syntax: !search path/filename  (can contain wildcards) "
                return 0
        }

        putserv "privmsg $chan :[glob [lindex [split $text] 0 ] ] "

}
###

Something like this is not limited in the code, as to where the user might search. Thus, the bind is flagged for use only by bot owner. Before you change that to something lesser, give it some thought.

Reference:
http://www.tcl.tk/man/tcl8.6/TclCmd/glob.htm
http://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm

Have fun with it. I hope that gets you started.
:)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
h
haferbrei
Voice
Posts: 23
Joined: Wed Apr 08, 2020 8:57 pm

Post by haferbrei »

I have solved it so similar :-)
Post Reply