use 5.014000;
use strict;
use warnings;
-our $VERSION = '0.001002';
+use utf8;
+use Encode qw/encode decode/;
+use Unicode::Normalize qw/NFC/;
+
+our $VERSION = '0.001003';
use List::Util qw/first/;
sub new {
my $class = shift;
my $self = {
- greetings => [qw/privet hello salut salutari neata neaţa neața neatza hola hey hi bonjour wassup sup hallo chikmaa tungjatjeta parev salam namaskaar mingalarba ahoy saluton allo moin aloha namaste shalom ciào ciao servus salve ave merhaba witaj hei hola selam sawubona/, "what's up", 'que tal', 'こんにちは', '你好', 'ni hao'],
+ greetings => [
+ qw/privet hello salut salutari neata neaţa neața neatza
+ hola hey hi bonjour wassup sup hallo chikmaa
+ tungjatjeta parev salam namaskaar mingalarba ahoy
+ saluton allo moin aloha namaste shalom ciào ciao servus
+ salve ave merhaba witaj hei hola selam sawubona
+ goedemorgen mogge hoi καλημέρα/,
+ 'what\'s up', 'que tal', 'こんにちは', '你好', 'ni hao',
+ 'добро јутро', 'γεια σας', 'bom dia', 'hyvää huomenta'],
@_
};
my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_;
my $nick = parse_user $$rfullname;
my $mynick = $irc->nick_name;
+ my $message = NFC decode 'UTF-8', $$rmessage;
my @hello = @{$self->{greetings}};
- my $match = first { $$rmessage =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/i } @hello;
- $irc->yield(privmsg => $$rchannels->[0] => $hello[int rand $#hello].", $nick") if $match;
+ my $match = first { $message =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/is } @hello;
+ my $randhello = encode 'UTF-8', $hello[int rand $#hello];
+ $irc->yield(privmsg => $$rchannels->[0] => "$randhello, $nick") if $match;
PCI_EAT_NONE
}
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2013 by Marius Gavrilescu
+Copyright (C) 2013-2015 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.14.2 or,