Code: Select all
namespace eval modecontrol {
variable enforceModes "" #Always keep these set
variable restrictModes "" #Never permit these to be set
proc raw:modeCheck {from key text} {
variable enforceModes
variable restrictModes
set from [split $from "!"]
set nick [lindex $from 0]
set handle [nick2hand $nick]
#Sanity check
if {[isbotnick $nick] || [matchattr $handle "+mnb"]} {
return 0
}
set items [split $text]
set enforce [split $enforceModes ""]
set restrict [split $restrictModes ""]
set target [lindex $items 0]
set add 1
set act 0
foreach mode [split [lindex $items 1] ""] {
switch -- $mode {
"+" {
set add 1
}
"-" {
set add 0
}
"I" -
"e" -
"b" {
set items [lreplace $items 2 2]
}
"k" {
if {$add} {
set key [lindex $items 2]
set items [lreplace $items 2 2]
}
}
"l" {
if {$add} {
set limit [lindex $items 2]
set items [lreplace $items 2 2]
}
}
default {
if {[lsearch $enforce $mode] >= 0 && !$add} {
pushmode $target "+$mode"
set act 1
} elseif {[lsearch $restrict $mode] >= 0 && $add} {
pushmode $target "-$mode"
set act 1
}
}
}
#Uncomment this to bounce key and limits
#if {[info exists key]} {
# pushmode $target -k $key
#}
#if {[info exists limit]} {
# pushmode $target -l
#}
}
if {$act && [llength $from] > 1} {
puthelp "NOTICE $nick :Please let me handle the channel mode settings."
}
return 0
}
bind raw - "MODE" [namespace current]::modeCheck
}
and now the script is working but opposite of what i requested:bind mode - "MODE" raw:modeCheck
It keep the settings that offender set that not added to the masters, owners, and other bots.User sets mode +m
User sets mode -m
Eggdrop sets mode +m
User sets mode +M
User sets mode -M
Eggdrop sets mode +M