| View previous topic :: View next topic |
| Author |
Message |
crux Voice

Joined: 05 Jan 2007 Posts: 35 Location: Myanmar
|
Posted: Tue Jan 23, 2007 2:28 pm Post subject: need little help. |
|
|
| Code: | #Make the bot KICK someone...
bind msg n|n .kick kick
proc kick {nick host handle channel testes} {
set who [lindex $testes 0]
set why [lrange $testes 1 end]
if {$who == ""} {
putserv "NOTICE $nick :Usage: .KICK <nick> <reason>"
return 1
}
putserv "KICK $who :$why"
putserv "NOTICE $nick :Done: KICKED $who with: $why"
return 1
}
#end of kick |
this code doesn't work. I think I need sth.. please help me if you know..
thanks you. _________________ Myanmar Chat Online
MCO Chat |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Tue Jan 23, 2007 3:12 pm Post subject: |
|
|
Try:
| Code: | #Make the bot KICK someone...
bind msg n|n .kick kick
proc kick {nick host handle channel testes} {
set who [lindex $testes 0]
set why [lrange $testes 1 end]
if {$who == ""} {
putserv "NOTICE $nick :Usage: .KICK <nick> <reason>"
} elseif {![onchan $who $channel]} {
putserv "NOTICE $nick :$who not on $channel."
} else {
if {$why == ""} {
putserv "KICK $channel $who :Requested by $nick"
} else {
putserv "KICK $channel $who :$why"
}
}
#end of kick |
Not Tested _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
crux Voice

Joined: 05 Jan 2007 Posts: 35 Location: Myanmar
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jan 23, 2007 3:35 pm Post subject: |
|
|
You might wanna keep in mind there's no "channel" argument on a msg-binding...
Also, please considder "splitting" strings into lists before using list-operations such as lindex, lrange, etc. Especially when it comes from an untrusted source (in this case, untrusted means anything that might generate an improper list-structure) _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
crux Voice

Joined: 05 Jan 2007 Posts: 35 Location: Myanmar
|
Posted: Thu Jan 25, 2007 3:55 pm Post subject: |
|
|
| Tosser^^ wrote: | Try:
| Code: | #Make the bot KICK someone...
bind msg n|n .kick kick
proc kick {nick host handle channel testes} {
set who [lindex $testes 0]
set why [lrange $testes 1 end]
if {$who == ""} {
putserv "NOTICE $nick :Usage: .KICK <nick> <reason>"
} elseif {![onchan $who $channel]} {
putserv "NOTICE $nick :$who not on $channel."
} else {
if {$why == ""} {
putserv "KICK $channel $who :Requested by $nick"
} else {
putserv "KICK $channel $who :$why"
}
}
#end of kick |
Not Tested |
donesn't work
i got this error:
| Code: | | [20:55] Tcl error [kick]: wrong # args: should be "kick nick host handle channel testes" |
_________________ Myanmar Chat Online
MCO Chat |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 25, 2007 4:34 pm Post subject: |
|
|
| nml375 wrote: | You might wanna keep in mind there's no "channel" argument on a msg-binding...
Also, please considder "splitting" strings into lists before using list-operations such as lindex, lrange, etc. Especially when it comes from an untrusted source (in this case, untrusted means anything that might generate an improper list-structure) |
i.e.
| Code: | bind msg n|n .kick kick
proc kick {nick host hand arg} {
if {[scan $arg "%s %s" who chan] != 2} {
puthelp "notice $nick :Usage: .kick <chan> <nick> \[reason\]"
return 0
}
set why [join [lrange [split $arg] 2 end]]
if {![onchan $who $chan]} {
puthelp "NOTICE $nick :$who not on $chan."
} {
if {$why == ""} {
putserv "KICK $chan $who :Requested by $nick"
} {
putserv "KICK $chan $who :$why"
}
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
crux Voice

Joined: 05 Jan 2007 Posts: 35 Location: Myanmar
|
|
| Back to top |
|
 |
|