App-SpreadRevolutionaryDate
view release on metacpan or search on metacpan
lib/App/SpreadRevolutionaryDate/Target/Freenode.pm view on Meta::CPAN
#
# This file is part of App-SpreadRevolutionaryDate
#
# This software is Copyright (c) 2019-2026 by Gérald Sédrati.
#
# This is free software, licensed under:
#
# The GNU General Public License, Version 3, June 2007
#
use 5.014;
use utf8;
package App::SpreadRevolutionaryDate::Target::Freenode;
$App::SpreadRevolutionaryDate::Target::Freenode::VERSION = '0.54';
# ABSTRACT: Target class for L<App::SpreadRevolutionaryDate> to handle spreading on Freenode.
use Moose;
with 'App::SpreadRevolutionaryDate::Target'
=> {worker => 'App::SpreadRevolutionaryDate::Target::Freenode::Bot'};
use App::SpreadRevolutionaryDate::Target::Freenode::Bot;
use POE;
use Locale::TextDomain 'App-SpreadRevolutionaryDate';
use namespace::autoclean;
has 'nickname' => (
is => 'ro',
isa => 'Str',
required => 1,
);
has 'password' => (
is => 'ro',
isa => 'Str',
required => 1,
);
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;
( run in 0.549 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )