dirkobot/lib/Bot/BasicBot/Pluggable/Module/Spam.pm

28 lines
748 B
Perl

package Bot::BasicBot::Pluggable::Module::Spam;
use strict;
use warnings;
use Data::Dumper;
use base qw(Bot::BasicBot::Pluggable::Module);
sub init {
my ($self) = @_;
$self->config({channel => "#dirkocraft",
when => 20,
what => q{Enjoying Dirkocraft? Please consider a donation to help out with hosting costs- It provides you with perks! See the "Donation" link on dirkocraft.com for details.},
});
}
our $counter = 0;
sub tick { # called every 5 seconds
my $self = shift;
my $time = $self->get("when") * 60; # gives us how often in seconds
$time /= 5; # gives us in ticks
unless ($counter++ % $time) {
$self->say({body => $self->get("what"), channel => $self->get("channel") });
};
}
1;