App-SpreadRevolutionaryDate
view release on metacpan or search on metacpan
lib/App/SpreadRevolutionaryDate/Target/Freenode.pm view on Meta::CPAN
has 'channels' => (
is => 'ro',
isa => 'ArrayRef[Str]',
required => 1,
);
around BUILDARGS => sub {
my ($orig, $class) = @_;
my $port = 6667;
my $ssl = 0;
# Switch to SSL if module POE::Component::SSLify is available
if (eval { require POE::Component::SSLify; 1 }) {
$port = 6697;
$ssl = 1;
}
my $args = $class->$orig(@_);
$args->{obj} = App::SpreadRevolutionaryDate::Target::Freenode::Bot->new(
server => 'irc.freenode.net',
port => $port,
nick => 'RevolutionaryBot',
alt_nicks => ['RevolutionaryCalendar', 'RevolutionaryDate'],
name => 'Revolutionary Date bot',
flood => 1,
useipv6 => 1,
ssl => $ssl,
charset => 'utf-8',
channels => $args->{channels},
freenode_nickname => $args->{nickname},
freenode_password => $args->{password},
msg => '',
no_run => 1,
);
return $args;
};
sub spread {
my ($self, $msg) = @_;
# Multiline message
$msg =~ s/\\n/\n/g;
$self->obj->msg($msg);
$self->obj->run;
POE::Kernel->run();
}
no Moose;
__PACKAGE__->meta->make_immutable;
# A module must return a true value. Traditionally, a module returns 1.
# But this module is a revolutionary one, so it discards all old traditions.
# Idea borrowed from Jean Forget's DateTime::Calendar::FrenchRevolutionary.
"Quand le gouvernement viole les droits du peuple,
l'insurrection est pour le peuple le plus sacré
et le plus indispensable des devoirs";
__END__
=pod
=encoding UTF-8
=head1 NAME
App::SpreadRevolutionaryDate::Target::Freenode - Target class for L<App::SpreadRevolutionaryDate> to handle spreading on Freenode.
=head1 VERSION
version 0.54
=head1 METHODS
=head2 new
Constructor class method, subclassing C<Bot::BasicBot>. Takes a hash argument with the following mandatory keys: C<nickname>, C<password>, and C<channels>, with all values being strings. Returns an C<App::SpreadRevolutionaryDate::Target::Freenode> ob...
=head2 spread
Spreads a message to Freenode channels configured with the multivalued option C<channels>.
=head1 SEE ALSO
=over
=item L<spread-revolutionary-date>
=item L<App::SpreadRevolutionaryDate>
=item L<App::SpreadRevolutionaryDate::Config>
=item L<App::SpreadRevolutionaryDate::BlueskyLite>
=item L<App::SpreadRevolutionaryDate::Target>
=item L<App::SpreadRevolutionaryDate::Target::Bluesky>
=item L<App::SpreadRevolutionaryDate::Target::Twitter>
=item L<App::SpreadRevolutionaryDate::Target::Mastodon>
=item L<App::SpreadRevolutionaryDate::Target::Freenode::Bot>
=item L<App::SpreadRevolutionaryDate::Target::Liberachat>
=item L<App::SpreadRevolutionaryDate::Target::Liberachat::Bot>
=item L<App::SpreadRevolutionaryDate::MsgMaker>
=item L<App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate>
=item L<App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Calendar>
( run in 0.574 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )