I just started with TCL and Eggbot a day ago.
I want to write a script which lists the contents of a directory.
The code is :
Code: Select all
bind pub - !mp3list mp3:list
proc mp3:list {nick user handle chan text} {
if {$chan == "#mp3"} {
foreach d [glob -nocomplain -types d /music/mp3/$text/*] {
putserv "PRIVMSG $nick : Dir in MP3/$text: $d "
}
foreach f [glob -nocomplain -types f /music/mp3/$text/*] {
putserv "PRIVMSG $nick : File in MP3/$text : $f"
}
}
}
First its very slow.
Second i can only run a query at once.
How should i change the code to solve these problems.
Another two questions:
1. Is it possible to list all files, which have been added the current day
2. Is it possible to link these files so that u click on a directory it makes the !mp3list with the path u clicked on if a file is choosen opens the file in the default player (only for unix boxes which have mounted the mp3 dir as on the server).
Thanks in advance.