Code: Select all
bind pub n .mv voice_all
set excnick {
"chanserv"
"somenick"
}
proc voice_all {nick host handle chan text} {
global excnick
if {![botisop $chan]} {
puthelp "NOTICE $nick :I'm not oped on $chan."
return
}
# grab the channel members list and exclude the bot from it
set userList [chanlist $chan]
set pos [lsearch -nocase $userList $::botnick]
set userList [lreplace $userList $pos $pos]
# build the op list with only people that aren't op or any other channel access level
foreach user [split $userList] {
if {![isvoice $user $chan] && ![isop $user $chan] && ![ishalfop $user $chan] && ![matchattr [nick2hand $user] o|o $chan] && [lsearch -nocase $excnick $user] == -1} { lappend voiceList $user }
}
# define the max amount of modes per line
set max 15
# op all the members in the above built voice list
if {[info exists voiceList]} {
set len [llength $voiceList]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "v" $max]
set users [join [lrange $voiceList 0 [expr {$max - 1}]]]
set voiceList [lrange $voiceList $max end]
incr len -$max
} else {
set mode [string repeat "v" $len]
set users [join $voiceList]
set len 0
}
putnow "MODE $chan +$mode $users"
}
puthelp "NOTICE $nick :Voiced all users on $chan."
} else {
puthelp "NOTICE $nick :Nobody needed to be Voiced on $chan."
}
}
a nick like {ykbeucwvi} would be seen as {{ykbeucwvi}}