I'm creating a small user's help guide for my bot so people can know all channel commands for the bot. This works to some degree. If I type in "!help google" I get the small help text that explains how to use it. But if I just use "!help" I get no response at all. It's probably just a total brain fart but I can't put my finger on it.
proc send:help {nick uhost hand chan args} {
#Bring in the default list
global helplist
if { $args != "" } {
put:help $args $nick
} else {
putserv "privmsg $nick :Current general commands include: $helplist"
putserv "privmsg $nick :For more information on a topic use \"!help topic\" (such as !help google)"
}
}
put:help is what calls if args is not blank, (ie, the "!help google", which works) What's not working is the else statement block.
Any suggestions?
Last edited by Vexor on Tue Jul 25, 2006 5:40 am, edited 2 times in total.
proc send:help {nick uhost hand chan args} {
#Bring in the default list
global helplist
if { [llength $args] > 0 } {
put:help $args $nick
} else {
putserv "privmsg $nick :Current general commands include: $helplist"
putserv "privmsg $nick :For more information on a topic use \"!help topic\" (such as !help google)"
}
}
bind - pub !help myproc
proc myproc {nick uhost hand chan text} {
set cmd [lindex [split $text] 0]
if {$cmd == "google"} {
puthelp "PRIVMSG $nick :Google help line 1"
puthelp "PRIVMSG $nick :Google help line 2 etc."
return
}
if {$cmd == "something"} {
# more stuff here
return
}
if {$cmd == ""} {
# Whatever you want..
# could also just use the next "else" part after any "if", for default help..
return
} else {
# default help stuff here...
return
}
}