]>
iEval git - poe-component-irc-plugin-hello.git/blob - Hello.pm
aff114e0475626db4ac54e866fc55c7ee1117b90
1 package POE
::Component
::IRC
::Plugin
::Hello
;
6 our $VERSION = '0.001002';
8 use List
::Util qw
/first/;
10 use IRC
::Utils qw
/parse_user/;
11 use POE
::Component
::IRC
::Plugin qw
/PCI_EAT_NONE/;
16 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'],
24 my ($self, $irc) = @_;
25 $irc->plugin_register($self, SERVER
=> qw
/public/);
29 sub PCI_unregister
{ 1 }
32 my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_;
33 my $nick = parse_user
$$rfullname;
34 my $mynick = $irc->nick_name;
35 my @hello = @
{$self->{greetings
}};
37 my $match = first
{ $$rmessage =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/i } @hello;
38 $irc->yield(privmsg
=> $$rchannels->[0] => $hello[int rand $#hello].", $nick") if $match;
47 POE::Component::IRC::Plugin::Hello - PoCo-IRC plugin that says hello
51 use POE::Component::IRC::Plugin::Hello;
53 my $irc = POE::Component::IRC::State->spawn(...);
54 $irc->plugin_add(Hello => POE::Component::IRC::Plugin::Hello->new);
58 POE::Component::IRC::Plugin::Hello is a PoCo-IRC plugin that greets back
59 who greet him or a channel in public. It knows how to say hello in several
60 languages, and greets people in a randomly chosen language.
62 The list of greetings is configurable by the plugin user.
66 L<POE::Component::IRC::Plugin>
70 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
72 =head1 COPYRIGHT AND LICENSE
74 Copyright (C) 2013 by Marius Gavrilescu
76 This library is free software; you can redistribute it and/or modify
77 it under the same terms as Perl itself, either Perl version 5.14.2 or,
78 at your option, any later version of Perl 5 you may have available.
This page took 0.044778 seconds and 3 git commands to generate.