It feels like you are breaking the [string match] command across lines.wile wrote:bot will reply for a massage at the channel or nick
but i have an error which is
Tcl error [replychan]: wrong # args: should be "string option arg ?arg ...?"
here is the source problem
proc replychan {nick uhost hand chan rest} {
global botnick repchan
foreach targchan $repchan {if {[string match *[string tolower $targchan]* [string tolower $chan]]} {append reps "$chan $rest" ; replyuser $nick $uhost $hand $reps ; return 0}}
}
Code: Select all
if { [string match *$targchan* \n
$chan]} { .... }
Code: Select all
if { [string match *$targchan* $chan] } { \n
... }
Code: Select all
if { [string match
hello world ]
} {
puts "match"
} {
puts "no match"
}
Another examplewrong # args: should be "string match ?-nocase? pattern string"
while executing
"string match "
(file "test.tcl" line 1)
Code: Select all
if { [string
match hello world ]
} {
puts "match"
} {
puts "no match"
}
wrong # args: should be "string option arg ?arg ...?"
while executing
"string "
(file "test.tcl" line 1)
First, I would assume that a channel name is a single word. But, if you insist...caesar wrote:try with two words like: foo bar .. and you will see a notable difference. if is one word only then is working, else.. see for yourself.
Now that I did see it for myself (as you asked), I wonder what your point is?tclsh8.3
% set targchan "foo bar"
foo bar
% set chan #foobar
#foobar
% string match *$targchan* $chan
0
% puts *$targchan*
*foo bar*
How would the code given by wile ever get to such a construction?caesar wrote:not like that silly.. like this: .tcl string match *foo* foo bar .. anyway, it realy dosen't matter.. I'm used to use the " to make the code look better and avoid any errors.