Code: Select all
set poemsdir "path/to/poems"
bind pub * !poems pub:poems
proc pub:poems {nick host handle channel text} {
catch { glob -type f $::poemsdir/* } poems
regsub -all "$::poemsdir/" $poems "" poems
putserv "PRIVMSG $channel :\002Poems\002: $poems"
}
Code: Select all
if {![file exists $::poemsdir]} {
putserv "PRIVMSG $channel :\002Error\002: $::poemsdir dose not exist."
return 0
}
Code: Select all
set poemsdir "/precieuse/histoires/"
bind pub * !poems pub:poems
proc pub:poems {nick host handle channel text} {
if {![file exists $::poemsdir]} {
putserv "PRIVMSG $channel :\002Error\002: $::poemsdir dose not exist."
return 0
}
catch { glob -type f $::poemsdir/ } poems
regsub -all "$::poemsdir/*" $poems "" poems
putserv "PRIVMSG $channel :\002Histoires\002: $poems"
}
Code: Select all
set poemsdir "/precieuse/histoires/"
set peomlimit 7
bind pub * !poems pub:poems
proc pub:poems {nick host handle channel text} {
if {![file exists $::poemsdir]} {
putserv "PRIVMSG $channel :\002Error\002: $::poemsdir dose not exist."
return 0
}
catch { glob -type f $::poemsdir/ } poems
regsub -all "$::poemsdir/*" $poems "" poems
set first [list]
foreach item $poems {
if {[llength $first] == $::peomlimit} {
putserv "PRIVMSG $channel :\002Histoires\002: [string trimright [join $first ", "] ", "]"
set first [list]
}
lappend fist $item
}
if {[length $first]} {
putserv "PRIVMSG $channel :\002Histoires\002: [string trimright [join $first ", "] ", "]"
}
}
Code: Select all
set poemsdir "/precieuse/histoires/"
set peomlimit 7
bind pub * !histoire pub:poems
proc pub:poems {nick host handle channel text} {
if {![file exists $::poemsdir]} {
putserv "PRIVMSG $channel :\002Error\002: $::poemsdir dose not exist."
return 0
}
catch { glob -type f $::poemsdir/ } poems
regsub -all "$::poemsdir/*" $poems "" poems
set first [list]
foreach item $poems {
if {[llength $first] == $::peomlimit} {
putserv "PRIVMSG $channel :\002Histoires\002: [string trimright [join $first ", "] ", "]"
set first [list]
}
lappend fist $item
}
if {[llength $first]} {
putserv "PRIVMSG $channel :\002Histoires\002: [string trimright [join $first ", "] ", "]"
}