mirror of
https://github.com/perlbot/perlbuut-pastebin
synced 2025-06-08 06:36:12 -04:00
23 lines
521 B
Perl
23 lines
521 B
Perl
package App::Model::Perlbot;
|
|
|
|
use strict;
|
|
use warnings;
|
|
use v5.22;
|
|
use Data::Dumper;
|
|
|
|
use Mojo::Base '-base';
|
|
|
|
has config => App::Config::get_config('announce');
|
|
|
|
sub announce {
|
|
my $self = shift;
|
|
my ($channel, $who, $what, $link) = @_;
|
|
|
|
my $socket = IO::Socket::INET->new( PeerAddr => $self->config->{server} //'localhost', PeerPort => $self->cfg->{port} //1784 )
|
|
or die "error: cannot connect to announce server";
|
|
|
|
print $socket "$channel\x1E$link\x1E$who\x1E$what\n";
|
|
close($socket);
|
|
}
|
|
|
|
1;
|