To execute the command channel (for full list commands) is:
To execute the command channel (for full particular command) is:!commands
For private messages is (for full list commands) :!commands <command>
But, not works for messages:commands
commands <command>
How do you, for boT interpret the event MSGM arguments after the command text?
Just accept me the command without arguments, that is, the command that displays a list of available commands of the bot, but does not allow me to show support for a particular command, running the SWITCH command .
Example of part code (the commands list is very long to put it all):
Code: Select all
##default prefix !, You can replace it##
set prefix "!"
set canal_radio #chann1
set canal_djs #chann2
set canal_admin #chann3
bind pub oa|n [string trim $prefix]commands pub:help
bind msgm oa|n commands pub:help
proc pub:help {nick uhost hand chan args} {
global botnick prefix canal_admin canal_djs
set args [split [cleanarg $args]]
if {(![matchattr $nick a|n]) && ([matchattr $nick +o])} {
if {[llength $args]<1} {
putmsg $nick "Commands list for Administrators"
putmsg $nick [encoding convertfrom utf-8 " - [string trim $prefix]comm1 - task xxx perform "]
putmsg $nick [encoding convertfrom utf-8 " - [string trim $prefix]comm2 - task xxx perform "]
putmsg $nick [encoding convertfrom utf-8 " - [string trim $prefix]comm3 - task xxx perform "]
### ....More help command.............###
} else {
if {[string index $args 0] == "$prefix"} { set args [string trimleft $args $prefix] }
set lines [comm1 comm2 comm3]
if {([lsearch -exact [string tolower $lines] $args] == -1)} { putmsg $chan "$nick Sorry I have no help for that command. \002$args.";return }
switch [lindex $args 0] {
"comm1" {
putmsg $nick "\002\0036<===--- !comm1 ---===>\0036\002"
putmsg $nick "Usage: [string trim $prefix]comm1 <nick Dj>"
putmsg $nick "Usage channels: $canal_admin and $canal_djs"
putmsg $nick [encoding convertfrom utf-8 "Function: xxxxxxx"]
putmsg $nick "\002\0036<===--- End help comannd !comm1 ---===>\0036\002"
}
"comm2" {
putmsg $nick "\002\0036<===--- !comm2 ---===>\0036\002"
putmsg $nick "Usage: [string trim $prefix]comm2 <#channel>"
putmsg $nick "Usage channels: $canal_admin and $canal_djs"
putmsg $nick [encoding convertfrom utf-8 "Function: xxxxxxx"]
putmsg $nick "\002\0036<===--- End help comannd !comm2 ---===>\0036\002"
}
"comm3" {
putmsg $nick "\002\0036<===--- !comm3 ---===>\0036\002"
putmsg $nick "Usage: [string trim $prefix]comm3 <nick>"
putmsg $nick "Usage channels: $canal_admin and"
putmsg $nick [encoding convertfrom utf-8 "Function: xxxxxxx"]
putmsg $nick "\002\0036<===--- End help comannd !comm3 ---===>\0036\002"
}
}
}
} else {
if {[llength $args]<1} {
putmsg $nick "Commands list for Roots"
putmsg $nick [encoding convertfrom utf-8 " - [string trim $prefix]comm1 - task xxx perform "]
putmsg $nick [encoding convertfrom utf-8 " - [string trim $prefix]comm2 - task xxx perform "]
putmsg $nick [encoding convertfrom utf-8 " - [string trim $prefix]comm3 - task xxx perform "]
### ....More help command.............###
} else {
if {[string index $args 0] == "$prefix"} { set args [string trimleft $args $prefix] }
set lines [comm1 comm2 comm3]
if {([lsearch -exact [string tolower $lines] $args] == -1)} { putmsg $chan "$nick Sorry I have no help for that command. \002$args.";return }
switch [lindex $args 0] {
"comm1" {
putmsg $nick "\002\0036<===--- !comm1 ---===>\0036\002"
putmsg $nick "Usage: [string trim $prefix]comm1 <nick Dj>"
putmsg $nick "Usage channels: $canal_admin and $canal_djs"
putmsg $nick [encoding convertfrom utf-8 "Function: xxxxxxx"]
putmsg $nick "\002\0036<===--- End help comannd !comm1 ---===>\0036\002"
}
"comm2" {
putmsg $nick "\002\0036<===--- !comm2 ---===>\0036\002"
putmsg $nick "Usage: [string trim $prefix]comm2 <#channel>"
putmsg $nick "Usage channels: $canal_admin and $canal_djs"
putmsg $nick [encoding convertfrom utf-8 "Function: xxxxxxx"]
putmsg $nick "\002\0036<===--- End help comannd !comm2 ---===>\0036\002"
}
"comm3" {
putmsg $nick "\002\0036<===--- !comm3 ---===>\0036\002"
putmsg $nick "Usage: [string trim $prefix]comm3 <nick>"
putmsg $nick "Usage channels: $canal_admin and"
putmsg $nick [encoding convertfrom utf-8 "Function: xxxxxxx"]
putmsg $nick "\002\0036<===--- End help comannd !comm3 ---===>\0036\002"
}
}
}
}
}
proc cleanarg {arg} {
set temp ""
for {set i 0} {$i < [string length $arg]} {incr i} {
set char [string index $arg $i]
if {($char != "\12") && ($char != "\15")} {
append temp $char
}
}
set temp [string trimright $temp "\}"]
set temp [string trimleft $temp "\{"]
return $temp
}
EDIT2: Translate variable name 'prefijo' to English 'prefix'.