blob: 7d25427a3b50e17745ecfea81b4f08657e60741a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
use strict;
use Irssi 20010920.0000 ();
use vars qw($VERSION %IRSSI);
$VERSION = "1.00";
%IRSSI = (
authors => 'David Leadbeater',
contact => 'dgl@dgl.cx',
name => 'autolimit',
description => 'does an autolimit for a channel, set variables in the script',
license => 'GNU GPLv2 or later',
url => 'http://irssi.dgl.cx/',
);
# Change these!
my $channel = "#channel";
my $offset = 5;
my $tolerence = 2;
my $time = 60;
sub checklimit {
my $c = Irssi::channel_find($channel);
return unless ref $c;
return unless $c->{chanop};
my $users = scalar @{[$c->nicks]};
if(($c->{limit} <= ($users+$offset-$tolerence)) ||
($c->{limit} > ($users+$offset+$tolerence))) {
$c->{server}->send_raw("MODE $channel +l " . ($users+$offset));
}
}
Irssi::timeout_add($time * 1000, 'checklimit','');
|