3 package Bot
::BasicBot
::Pluggable
::Module
::WikiLinker
;
4 use Bot
::BasicBot
::Pluggable
::Module
;
5 use base
qw(Bot::BasicBot::Pluggable::Module);
14 '#wikinews-spam' => 'https://en.wikinews.org/w/api.php',
15 '#wikipedia-ru-spam' => 'https://ru.wikipedia.org/w/api.php',
19 # Secondary variables.
20 for my $channel_name (keys %channels_urls) {
21 $mw{$channel_name} = MediaWiki
::API
->new();
22 $mw{$channel_name}->{config
}->{api_url
} = $channels_urls{$channel_name};
26 shift->process_message(@_);
30 shift->process_message(@_);
34 my ($self, $msg, $pri) = @_;
35 my $body = $msg->{body
};
36 my $who = $msg->{who
};
37 my $channel = $msg->{'channel'};
38 if (!grep { $_ eq $channel } keys %channels_urls){
41 if ($body =~ m{\[\[(.*?)\]\]} or $body =~ m{\{\{(.*?)\}\
}}g
){
42 return join " ", @
{WikiLinkParser
->get_urls_by_text($body, $mw{$channel})};
48 return "parser for [[*]] in messages";