##################################################
### Start editing variables from here onwards! ###
##################################################
#Set the channels here on which you wish to activate limiting. This should be in
#the format of a list, like: "#elephants #wildlife #awyeah". Leave this setting
#to "*" if you wish to activate limiting on all channels the bot is on.
set limit(channels) "#joy #новости #Шанс"
#Set the limit to increase here. (number of users on the channel + this setting)
set limit(newlimit) "5"
#Set the grace limit here. (if the limit doesn't need to be changed by more than
#this, don't bother setting a new limit)
set limit(grace) "2"
#Set the frequency of checking the limit here. Value should be in seconds.
set limit(utimer) "1"
###############################################################################
### Don't edit anything else from this point onwards, even if you know tcl! ###
###############################################################################
set limit(auth) "\x61\x77\x79\x65\x61\x68"
set limit(ver) "v1.6.b"
bind join - "*" limit:change:delay
proc limit:change:delay {nick uhost hand chan} {
global limit limitdelay
set chan [string tolower $chan]
if {[isbotnick $nick]} {
if {([lsearch -exact [split [string tolower $limit(channels)]] $chan] != -1) || ($limit(channels) == "*")} {
set chan [split $chan]; set limitdelay($chan) 1
utimer 3 [list unset limitdelay($chan)]
}
}
}
proc limit:change {} {
global limit limitdelay
utimer $limit(utimer) limit:change
foreach chan [channels] {
if {($limit(channels) != "*") && ([lsearch -exact [split [string tolower $limit(channels)]] [string tolower $chan]] == -1)} { continue }
set chan [string tolower $chan]
if {[info exists limitdelay([split $chan])]} { continue }
if {![botisop $chan] || ![botonchan $chan]} { continue }
if {[string match "*l*" [lindex [getchanmode $chan] 0]]} {
set currentlimit [join [lindex [split [getchanmode $chan]] end]]
} else {
set currentlimit 0
}
if {![string is integer $currentlimit]} { continue }
set newlimit [expr [llength [chanlist $chan]] + $limit(newlimit)]
if {$newlimit == $currentlimit} { continue }
if {$newlimit > $currentlimit} {
set difference [expr $newlimit - $currentlimit]
} elseif {$currentlimit > $newlimit} {
set difference [expr $currentlimit - $newlimit]
}
if {$difference <= $limit(grace)} { continue }
putquick "MODE $chan +l $newlimit" -next
}
}
proc limit:start {} {
global limit
if {[string match "*limit:change*" [utimers]]} { return 0 }
utimer $limit(utimer) limit:change
}
limit:start
if {![string equal "\x61\x77\x79\x65\x61\x68" $limit(auth)]} { set limit(auth) \x61\x77\x79\x65\x61\x68 }
if {$limit(channels) == "*"} {
putlog "chanlimit.tcl $limit(ver) by $limit(auth) has been loaded successfully. (On: all channels the bot is on)"
} else {
putlog "chanlimit.tcl $limit(ver) by $limit(auth) has been loaded successfully. (On: [split [string tolower $limit(channels)]])"
}
### Start editing variables from here onwards! ###
##################################################
#Set the channels here on which you wish to activate limiting. This should be in
#the format of a list, like: "#elephants #wildlife #awyeah". Leave this setting
#to "*" if you wish to activate limiting on all channels the bot is on.
set limit(channels) "#joy #новости #Шанс"
#Set the limit to increase here. (number of users on the channel + this setting)
set limit(newlimit) "5"
#Set the grace limit here. (if the limit doesn't need to be changed by more than
#this, don't bother setting a new limit)
set limit(grace) "2"
#Set the frequency of checking the limit here. Value should be in seconds.
set limit(utimer) "1"
###############################################################################
### Don't edit anything else from this point onwards, even if you know tcl! ###
###############################################################################
set limit(auth) "\x61\x77\x79\x65\x61\x68"
set limit(ver) "v1.6.b"
bind join - "*" limit:change:delay
proc limit:change:delay {nick uhost hand chan} {
global limit limitdelay
set chan [string tolower $chan]
if {[isbotnick $nick]} {
if {([lsearch -exact [split [string tolower $limit(channels)]] $chan] != -1) || ($limit(channels) == "*")} {
set chan [split $chan]; set limitdelay($chan) 1
utimer 3 [list unset limitdelay($chan)]
}
}
}
proc limit:change {} {
global limit limitdelay
utimer $limit(utimer) limit:change
foreach chan [channels] {
if {($limit(channels) != "*") && ([lsearch -exact [split [string tolower $limit(channels)]] [string tolower $chan]] == -1)} { continue }
set chan [string tolower $chan]
if {[info exists limitdelay([split $chan])]} { continue }
if {![botisop $chan] || ![botonchan $chan]} { continue }
if {[string match "*l*" [lindex [getchanmode $chan] 0]]} {
set currentlimit [join [lindex [split [getchanmode $chan]] end]]
} else {
set currentlimit 0
}
if {![string is integer $currentlimit]} { continue }
set newlimit [expr [llength [chanlist $chan]] + $limit(newlimit)]
if {$newlimit == $currentlimit} { continue }
if {$newlimit > $currentlimit} {
set difference [expr $newlimit - $currentlimit]
} elseif {$currentlimit > $newlimit} {
set difference [expr $currentlimit - $newlimit]
}
if {$difference <= $limit(grace)} { continue }
putquick "MODE $chan +l $newlimit" -next
}
}
proc limit:start {} {
global limit
if {[string match "*limit:change*" [utimers]]} { return 0 }
utimer $limit(utimer) limit:change
}
limit:start
if {![string equal "\x61\x77\x79\x65\x61\x68" $limit(auth)]} { set limit(auth) \x61\x77\x79\x65\x61\x68 }
if {$limit(channels) == "*"} {
putlog "chanlimit.tcl $limit(ver) by $limit(auth) has been loaded successfully. (On: all channels the bot is on)"
} else {
putlog "chanlimit.tcl $limit(ver) by $limit(auth) has been loaded successfully. (On: [split [string tolower $limit(channels)]])"
}
вот смотрите мою проблему,
На канале сидит 8 человек лимит стоит 13
22:15:35™ * Приходит: колян (~nlo@109.108.36.148)
22:16:03™ * Приходит: nlo (~nlo@109.108.36.148)
22:16:07™ * venera меняет режим: +l 15
ладно тут все норм,но вот когда уходят
то бот так и сотавляет лимит 15 ,как сделать что бы он менял тоже когда и выходят
И еще вот какая проблема,ставлю канал #новости и #шанс, на канале новости бот меняет лимит а на #шанс пишет
[22:25:40] Tcl error in script for 'timer95659':
[22:25:40] illegal channel: #ЬЮМЯ
Как я понял он не распознает букву Ш ,но бот с сузи патчем,помогите исправить.
Заранее спасибо