1 package POE
::Component
::IRC
::Plugin
::Hello
0.001;
7 use List
::Util qw
/first/;
9 use IRC
::Utils qw
/parse_user/;
10 use POE
::Component
::IRC
::Plugin qw
/PCI_EAT_NONE/;
15 greetings
=> [qw
/privet hello salut salutari neata neaţa hola hey hi bonjour niihau 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', 'こんにちは', '你好'],
23 my ($self, $irc) = @_;
24 $irc->plugin_register($self, SERVER
=> qw
/public/);
28 sub PCI_unregister
{ 1 }
31 my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_;
32 my $nick = parse_user
$$rfullname;
33 my $mynick = $irc->nick_name;
34 my @hello = @
{$self->{greetings
}};
36 my $match = first
{ $$rmessage =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*$/i } @hello;
37 $irc->yield(privmsg
=> $$rchannels->[0] => $hello[int rand $#hello].", $nick") if $match;
46 POE::Component::IRC::Plugin::Hello - PoCo-IRC plugin that says hello
50 use POE::Component::IRC::Plugin::Hello;
52 my $irc = POE::Component::IRC::State->spawn(...);
53 $irc->plugin_add(Hello => POE::Component::IRC::Plugin::Hello->new);
57 POE::Component::IRC::Plugin::Hello is a PoCo-IRC plugin that greets back
58 who greet him or a channel in public. It knows how to say hello in several
59 languages, and greets people in a randomly chosen language.
61 The list of greetings is configurable by the plugin user.
65 L<POE::Component::IRC::Plugin>
69 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
71 =head1 COPYRIGHT AND LICENSE
73 Copyright (C) 2013 by Marius Gavrilescu
75 This library is free software; you can redistribute it and/or modify
76 it under the same terms as Perl itself, either Perl version 5.14.2 or,
77 at your option, any later version of Perl 5 you may have available.
This page took 0.023297 seconds and 5 git commands to generate.