Code: Select all
namespace eval av {
set duration 360
setudef flag av
array set ignoreList {}
bind join - * [namespace current]::joining
bind pub o|o !voice [namespace current]::voice
bind pub o|o !devoice [namespace current]::devoice
bind mode - "% +v" [namespace current]::mcVoice
bind mode - "% -v" [namespace current]::mcDevoice
bind cron - {*/1 * * * *} [namespace current]::reset
proc joining {nick uhost hand chan} {
global ignoreList
if {![channel get $chan av] || [isbotnick $nick] || ![botisop $chan]} return
if {[lsearch -nocase [dict keys [join $ignoreList($chan)]] $uhost] < 0} {
pushmode $chan +v $nick
}
}
proc voice {nick uhost hand chan text} {
if {![channel get $chan av] || ![botisop $chan] || ![llength $text]} return
foreach user [split $text] {
if {[isbotnick $user] || ![onchan $user] || [isvoice $user $chan]} continue
lappend voiceList $user
}
if {[info exists voiceList]} {
push $chan "+" $voiceList
}
}
proc devoice {nick uhost hand chan text} {
if {![channel get $chan av] || ![botisop $chan] || ![llength $text]} return
foreach user [split $text] {
if {[isbotnick $user] || ![onchan $user] || ![isvoice $user $chan]} continue
lappend voiceList $user
}
if {[info exists voiceList]} {
push $chan "-" $voiceList
}
}
proc push {chan mc userList} {
set max 6
set len [llength $userList]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "v" $max]
set users [join [lrange $userList 0 [expr {$max - 1}]]]
set userList [lrange $userList $max end]
incr len -$max
} else {
set mode [string repeat "v" $len]
set users [join $userList]
set len 0
}
pushmode $chan $mc$mode $users
}
}
proc mcVoice {nick uhost hand chan mc target} {
global ignoreList
if {![channel get $chan av] || ![botisop $chan]} return
if {[array get ignoreList $chan] != {}} {
set pos [lsearch -nocase [dict keys [join $ignoreList($chan)]] $uhost]
if ($pos >= 0) {
set ignoreList($chan) [lreplace $ignoreList($chan) $pos $pos]
}
}
}
proc mcDevoice {nick uhost hand chan mc target} {
global ignoreList
if {![channel get $chan av] || ![botisop $chan]} return
set now [clock seconds]
if {[array get ignoreList $chan] != {}} {
set pos [lsearch -nocase [dict keys [join $ignoreList($chan)]] $uhost]
if ($pos >= 0) {
set ignoreList($chan) [lreplace $ignoreList($chan) $pos $pos [list $uhost $now]]
return
}
}
lappend ignoreList($chan) [list $uhost $now]
}
proc reset {min hour day month weekday} {
global ignoreList
global duration
set now [clock seconds]
foreach chan [channels] {
if {![channel get $chan av]} {
if {[array get ignoreList $chan] != {}} {
array unset ignoreList $chan
}
continue
}
if {[array get ignoreList $chan] != {}} {
set x 0
foreach time [dict values [join $ignoreList(a)]] {
if {($now - $time) >= $duration} {
set ignoreList($chan) [lreplace $ignoreList($chan) $x $x]
incr x
}
}
}
}
}
}
Code: Select all
bind join - * [namespace current]::joining
bind pub o|o !voice [namespace current]::voice
bind pub o|o !devoice [namespace current]::devoice
Code: Select all
namespace eval av {
set duration 60
setudef flag av
array set ignoreList {}
bind join * * [namespace current]::joining
bind pub o !voice [namespace current]::voice
bind pub o !devoice [namespace current]::devoice
bind mode - "% +v" [namespace current]::mcVoice
bind mode - "% -v" [namespace current]::mcDevoice
bind cron - {*/1 * * * *} [namespace current]::reset
proc joining {nick uhost hand chan} {
variable ignoreList
if {![channel get $chan av] || [isbotnick $nick] || ![botisop $chan]} return
if {[array get ignoreList $chan] != {}} {
if {[lsearch -nocase [dict keys [join $ignoreList($chan)]] $uhost] != -1} return
}
pushmode $chan +v $nick
}
proc voice {nick uhost hand chan text} {
variable ignoreList
if {![channel get $chan av] || ![botisop $chan] || ![llength $text]} return
foreach user [split $text] {
if {[isbotnick $user] || ![onchan $user $chan] || [isvoice $user $chan]} continue
lappend voiceList $user
}
if {[info exists voiceList]} {
push $chan "+" $voiceList
}
}
proc devoice {nick uhost hand chan text} {
if {![channel get $chan av] || ![botisop $chan] || ![llength $text]} return
foreach user [split $text] {
if {[isbotnick $user] || ![onchan $user $chan] || ![isvoice $user $chan]} continue
lappend voiceList $user
}
if {[info exists voiceList]} {
push $chan "-" $voiceList
}
}
proc push {chan mc userList} {
set max 6
set len [llength $userList]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "v" $max]
set users [join [lrange $userList 0 [expr {$max - 1}]]]
set userList [lrange $userList $max end]
incr len -$max
} else {
set mode [string repeat "v" $len]
set users [join $userList]
set len 0
}
pushmode $chan $mc$mode $users
}
}
proc mcVoice {nick uhost hand chan mc target} {
variable ignoreList
if {![channel get $chan av] || ![botisop $chan]} return
if {[array get ignoreList $chan] != {}} {
set pos [lsearch -nocase [dict keys [join $ignoreList($chan)]] [getchanhost $target $chan]]
if {$pos >= 0} {
set ignoreList($chan) [lreplace $ignoreList($chan) $pos $pos]
}
}
}
proc mcDevoice {nick uhost hand chan mc target} {
variable ignoreList
if {![channel get $chan av] || ![botisop $chan]} return
set now [clock seconds]
set uhost [getchanhost $target $chan]
if {[array get ignoreList $chan] != {}} {
set pos [lsearch -nocase [dict keys [join $ignoreList($chan)]] $uhost]
if {$pos >=0 } {
set ignoreList($chan) [lreplace $ignoreList($chan) $pos $pos [list $uhost $now]]
return
}
}
lappend ignoreList($chan) [list $uhost $now]
}
proc reset {min hour day month weekday} {
variable ignoreList
variable duration
set now [clock seconds]
foreach chan [channels] {
if {![channel get $chan av]} {
if {[array get ignoreList $chan] != {}} {
array unset ignoreList $chan
}
continue
}
if {[array get ignoreList $chan] != {}} {
set x 0
foreach time [dict values [join $ignoreList($chan)]] {
if {($now - $time) >= $duration} {
set ignoreList($chan) [lreplace $ignoreList($chan) $x $x]
incr x
}
}
}
}
}
}
Code: Select all
pushmode $chan $mc$mode $users
Code: Select all
putquick "MODE $chan $mc$mode $users"
to:pushmode $chan +v $nick
2. The error message I shared with you in my previous post means nothing?putquick "MODE $chan +v $nick"