| View previous topic :: View next topic |
| Author |
Message |
neoclust Halfop
Joined: 14 Aug 2009 Posts: 55
|
Posted: Fri Mar 05, 2010 7:18 am Post subject: Bind dcc - voice |
|
|
Everything is in the title please i want a script that voice in mass in dcc
ex: .+v nick1 nick2 nick3 nick4 nick5 nick6 #channel |
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Sun Mar 07, 2010 7:17 am Post subject: |
|
|
| Code: | proc dcc:+v {hand idx text} {
set chan [join [lrange [split $text] end end]]
set vnicks [join [lrange [split $text] end-1 end-1]]
if {$vnicks == ""} {
putidx $idx "Usage: +v <nicknames ...> \[#channel\]"
return 1
}
if {([regexp {^#} $chan])&&(![validchan "$chan"])} {
if {(![validchan [lindex [split [console $idx]] 0]])} {
putidx $idx "Usage: +v <nicknames ...> \[#channel\]"
return 1
} else {
set chan [lindex [split [console $idx]] 0]
}
}
if {![botisop $chan]} {
putidx $idx "Sorry, I'm not a channel operator on $chan"
return 1
}
foreach nicks $vnicks {
pushmode $chan +v $nicks
}
return 1
}
bind dcc o|- +v dcc:+v | * Not Tested, any problems please post reply. _________________ TCL the misunderstood |
|
| Back to top |
|
 |
neoclust Halfop
Joined: 14 Aug 2009 Posts: 55
|
Posted: Sun Mar 07, 2010 8:48 am Post subject: |
|
|
Thanks man i made this code but it does not work as it should, thank you filed this procedure I'll test it.
| Code: |
bind dcc n +v mass:voice
proc mass:voice {hand idx arg} {
set nick1 [lindex $arg 0]
set nick2 [lindex $arg 2]
set nick3 [lindex $arg 3]
set nick4 [lindex $arg 4]
set nick5 [lindex $arg 5]
set nick6 [lindex $arg 6]
set nick7 [lindex $arg 7]
set chan "#chan"
foreach nick [list $nick1 $nick2 $nick3 $nick4 $nick5 $nick6 $nick7] { pushmode $chan +v $nick }
}
|
|
|
| Back to top |
|
 |
neoclust Halfop
Joined: 14 Aug 2009 Posts: 55
|
Posted: Sun Mar 07, 2010 9:00 am Post subject: |
|
|
when I forget to put the #channel on the line I get it
(me): .+v angel Fury
((bot): [12:57] Tcl error [dcc:+v]: illegal channel: cryp
it should print some other exception I suppose, Ex: please put the channel name instead of "Tcl error [dcc:+v]: illegal channel: Fury" and
I noticed that the bot does not voice the entire list just one nick
Thanks |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Mar 07, 2010 2:25 pm Post subject: |
|
|
Tcl_no_tk:
Just a few remarks;
vnicks is a string, not a list. Thus not suitable for use with foreach.
[join [lrange [split $text] end end]] is the same as [lindex [split $text] end], same goes for end-1.
If the last word is not a valid channel, wouldn't this be a nickname to voice then? (add it to the list of nicks to voice)
The console command returns a list, not a string. Don't use split here.
I'd write the script somewhat like this:
| Code: | proc dcc:pv {handle idx text} {
set list [split $text]
if {[validchan [lindex $list end]]} {
set channel [lindex $list end]
set list [lrange $list 0 end-1]
} elseif {[validchan [lindex [console $idx] 0]]} {
set channel [lindex [console $idx] 0]
} else {
putidx $idx {Usage: +v <nickname> [nickname] ... [channel]}
return 1
}
if {![botonchan $channel] || ![botisop $channel]} {
putidx $idx "I am currently not a channel operator on $channel"
}
foreach vnick [lsort -unique $list] {
pushmode $channel +v $vnick
}
}
bind dcc o|o +v dcc:pv |
This could be more optimized, but I've kept it like this to make it easier to follow the flow of the code. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
neoclust Halfop
Joined: 14 Aug 2009 Posts: 55
|
Posted: Sun Mar 07, 2010 5:47 pm Post subject: |
|
|
| Thanks dude it's fine |
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
|
| Back to top |
|
 |
|