# chanlimit.tcl for netbots.tcl v3.15
# designed to work with eggdrop 1.5.2 or higher
# Johoho's Eggdrop Page - http://johoho.eggdrop.cx
# chanlimit.tcl copyright (c) 1999,2000 by johoho <johoho@hojo-net.de>
# netbots.tcl copyright (c) 1998-2000 by slennox <slennox@egghelp.org>

## chanlimit.tcl component script v3.15.0+johoho ##
# script is a modification of slennox's chanlimit.tcl component v.3.15

Please note that this component is an enhanced version of the chanlimit.tcl shipped with netbots.tcl distribution.

This script maintains a user limit (+l mode) in channels your bot is in. It is used primarily to help discourage and reduce the effects of large flood attacks.


#### DCC commands
.dolimit to run limit checking on demand
.stoplimit to temporarily stop limiting
.startlimit to restart limiting


#### Installation
To install this component properly you have to copy it to your netbots directory and add these lines to your netset.tcl conf:

## netset.tcl
# chanlimit.tcl settings
set nb_component(chanlimit) 0
set cl_chans ""
set cl_echans ""
set cl_limit 10
set cl_grace 2
set cl_timer 10
set cl_log 1
set cl_bots ""


## Settings Documentation:

cl_chans  (default: "")
  List of channels in which to activate limiting.
  Valid settings: one channel like "#donkeys", a list of channels like "#donkeys #cows #pigs", or "" to activate on all channels (except those listed in cl_echans).

cl_echans  (default: "")
  List of channels in which to skip limiting.
  Valid settings: one channel like "#donkeys", a list of channels like "#donkeys #cows #pigs", or "" to switch this off.

cl_limit  (default: 10)
  The limit to set. It will equal the number of users on the channel + this number - e.g. if there are 15 users on the channel and cl_limit is 10, the limit will be set to 25.
  Valid settings: 1 or higher.

cl_grace  (default: 2)
  If the limit doesn't need to be changed by more than this number, don't bother setting a new limit. This reduces annoying, unnecessary limit changes.
  Valid settings: 0 to disable, otherwise 1 or higher.

cl_timer  (default: 10)
  Frequency of checking whether a new limit needs to be set (in minutes). Setting this too low (e.g. less than 3 mins) isn't recommended, as it defeats the purpose if limiting. The more bots you have running chanlimit, the higher you should set this.
  Valid settings: 1 or higher.

cl_log  (default: 1)
  Log limit changes?
  Valid settings: 1 to enable, 0 to disable.

cl_bots  (default: "")
  This setting requires a space separated list of bots. If all of these bots are not on the channel, the bot will change limit itself. Please note that bots have to be in userfile and must have working hostmaks.
  Valid settings: one bot like "stan", a list of bots like "stan guybrush", or "" to force the bot to change limit always by itself