Code: Select all
bind mode - {% +m} rem:mi
bind mode - {% +i} rem:mi
proc rem:mi {nick uhost hand chan mc targ} {
global remmi
set remmi($mc:$chan) 1
if {![info exists remmi(+m:$chan)] || ![info exists remmi(+i:$chan)]} {
return 0
}
if {$remmi(+m:$chan) && $remmi(+i:$chan)} {
timer 2 [list rem:modes $chan]
}
}
proc rem:modes chan {
global remmi
pushmode $chan -m
pushmode $chan -i
set remmi(+m:$chan) [set remmi(+i:$chan) 0]
}
Code: Select all
timer 2 [list rem:modes $chan]
Code: Select all
utimer 30 [list rem:modes $chan]
Code: Select all
bind mode - {% +m} rem:mi
bind mode - {% +i} rem:mi
bind mode - {% +r} rem:mi
proc rem:mi {nick uhost hand chan mc targ} {
global remmi
set remmi($mc:$chan) 1
if {![info exists remmi(+m:$chan)] || ![info exists remmi(+r:$chan)] || ![info exists remmi(+i:$chan)]} {
return 0
}
if {$remmi(+m:$chan) && {$remmi(+i:$chan) && $remmi(+r:$chan)} {
utimer 30 [list rem:modes $chan]
}
}
proc rem:modes chan {
global remmi
pushmode $chan -m
pushmode $chan -i
pushmode $chan -r
set remmi(+m:$chan) [set remmi(+i:$chan) [set remmi(+r:$chan) 0]
Code: Select all
bind mode - {% +m} rem:mi
bind mode - {% +i} rem:mi
bind mode - {% +r} rem:mi
proc rem:mi {nick uhost hand chan mc targ} {
global remmi
set remmi($mc:$chan) 1
if {![info exists remmi(+m:$chan)] || ![info exists remmi(+r:$chan)] || ![info exists remmi(+i:$chan)]} {
return 0
}
if {$remmi(+m:$chan) && $remmi(+i:$chan) && $remmi(+r:$chan)} {
utimer 30 [list rem:modes $chan]
}
}
proc rem:modes chan {
global remmi
pushmode $chan -m
pushmode $chan -i
pushmode $chan -r
set remmi(+m:$chan) [set remmi(+i:$chan) [set remmi(+r:$chan) 0]]
}
Code: Select all
setudef str remove-modes
bind MODE -|- "% +*" check:mode
proc check:mode {nickname hostname handle channel mode target} {
if {[set remmodes [channel get $channel "remove-modes"]] == ""} {
return 0
}
set mode [string trimleft $mode "+"]
if {[string match *$mode* $remmodes]} {
utimer 60 [list pushmode $channel -$mode]
}
}
So, in your case metroid, $mode will never contain more than one mode. Also, the wildcards in [string match] can only be applied on the first operand and not the 2nd. Another problem with your code is that it's reapplying the mode which is not what's requested, and of course setting +$mode is not valid since mode already contains the '+' char.MODE (stackable)
bind mode <flags> <mask> <proc>
proc-name <nick> <user@host> <handle> <channel> <mode-change> <target>
Description: mode changes are broken down into their component
parts before being sent here, so the <mode-change> will always
be a single mode, such as "+m" or "-o". target will show the
argument of the mode change (for o/v/b/e/I) or "" if the set
mode does not take an argument. The bot's automatic response
to a mode change will happen AFTER all matching Tcl procs are
called. The mask will be matched against '#channel +/-modes'
and can contain wildcards.
And in this case, it will wait long enough to set the other modes too.pushmode <channel> <mode> [arg]
Description: sends out a channel mode change (ex: pushmode #lame +o
goober) through the bot's queuing system. All the mode changes will
be sent out at once (combined into one line as much as possible) after
the script finishes, or when 'flushmode' is called.
Returns: nothing
Module: irc
Code: Select all
if {[string match $remmodes *$mode*]} {
Code: Select all
if {[string match *$mode* $remmodes]} {