#--------------------------------------------------------------------- # mycmds.tcl # Tcl script for IRC bot eggdrop # # On a public !mycmds the script will tell the public commands the # user can use. # # v0: 28-Sep-2003 #--------------------------------------------------------------------- package require eggdrop 1.6.15 package require Tcl 8.0 bind PUB - !mycmds pub:mycmds proc pub:mycmds { nick uhost hand chan text } { # retrieve all PUB bindings set bindslist [binds pub] set mycmds [list] foreach trigger $bindslist { set flags [lindex $trigger 1] # do not list general triggers and triggers the handle does not # have the correct flags for. if { $flags != {-|-} && ![matchattr $hand $flags $chan] } { continue } # add matching triggers to mycmds set name [lindex $trigger 2] set current [lindex $mycmds end] set curlen [string length $current] # limit string length to 300 if { [expr $curlen + [string length $name]] > 300 } { lappend mycmds $name } else { set mycmds [lreplace $mycmds end end "$current $name"] } } # in case no commands were found if { [llength $mycmds] == 0 } { puthelp "PRIVMSG $chan :\002$nick\002 NO public commands for you!" return 1 } # report the commands available for $nick foreach line $mycmds { puthelp "PRIVMSG $chan :\002$nick\002 $line" } return 1 } putlog "Show my public commands (!mycmds) version 0 loaded."