Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Irssi;
- use strict;
- use vars qw($VERSION %IRSSI);
- $VERSION = "1.0";
- %IRSSI = (
- authors => 'Your nick',
- contact => 'Your email',
- name => 'Idle Reward',
- description => 'Gives voice to idle users in #syndykat channel after 120 minutes and announces a reward.',
- license => 'License of your choice',
- url => 'URL to your script',
- );
- my %idle_users;
- my $bot_name = "IdleBot"; # Replace with the name of your bot
- my $owner_host = "*!_y\@tahio.eu"; # Replace with the owner's hostmask
- sub check_idle_users {
- my $channel = Irssi::channel_find("#syndykat");
- foreach my $nick (keys %idle_users) {
- my $idle_time = time() - $idle_users{$nick}->{'idle_time'};
- if ($idle_time >= 7200) {
- $channel->command("mode $channel->{'name'} +v $nick");
- $channel->printformat(MSGLEVEL_CRAP, 'idle_reward', $nick);
- $idle_users{$nick}->{'idle_time'} = time();
- }
- }
- }
- sub event_public {
- my ($server, $msg, $nick, $mask, $target) = @_;
- if ($target eq "#syndykat") {
- if ($mask eq $owner_host && $msg =~ /^!start$/) {
- if (!$idle_users{$nick}) {
- $idle_users{$nick} = {
- 'idle_time' => time()
- };
- } else {
- $idle_users{$nick}->{'idle_time'} = time();
- }
- my $channel = Irssi::channel_find("#syndykat");
- $channel->command("mode $channel->{'name'} +v $nick");
- $channel->printformat(MSGLEVEL_CRAP, 'idle_start', $nick);
- }
- }
- }
- Irssi::theme_register([
- 'idle_start', 'Start idleC by {nick $0}!'
- ]);
- Irssi::signal_add('message public', 'event_public');
- Irssi::timeout_add(60000, 'check_idle_users', undef);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement