can someome make a script that will put a especific channel +i during a especific hour of the day, for example lock the channel all day except from 20:00 to 00:00
# channel
variable lockchan "#mychannel"
# durations
variable lockstart 20
variable lockend 23
# changed the time bind to do this _AT_ the start
# of every hour, since we base this on hours, and
# not to run the proc every minute needlessly
# checking when to change modes...
bind time - "00 *" lock:chan
proc lock:chan {min hour args} {
global lockchan
if {![botisop $lockchan]} return
set hr [scan $hour %d]
# stole this from nml375 this allows wrapping of start/end hours.
if {($hour >= $::lockstart && $hour < $::lockend || \
($hour >= $::lockstart || $hour < $::lockend) && \
$::lockstart > $::lockend) && [string match "*i*" [getchanmode #channel]]} {
channel set $lockchan chanmode -i
} else {
channel set $lockchan chanmode +i
}
}
You simply channel set (chanset) the #channel's chanmode settings to keep this from happening. This also keeps other ops from changing this schedule making the bot enforce these modes during these time periods.
The main logic problem, is that you test if the time is within the desired range (correct) and if mode i is set (incorrect).
If i is not set, the logics will always evaluate to false, and the channel will be set +i. As such, you'll still end up adding and removing the i mode every other minute.
Solution would be to nest the mode check, rather than AND it to the time-check: