1POE::Component::IRC::PlUusgeirn:C:oBnottrAidbduPrtOeeEsd:s:ePCdeo(rm3lp)oDnoecnutm:e:nItRaCt:i:oPnlugin::BotAddressed(3)
2
3
4
6 POE::Component::IRC::Plugin::BotAddressed - A POE::Component::IRC plug‐
7 in that generates 'irc_bot_addressed' events whenever someone addresses
8 your bot by name in a channel.
9
11 use POE::Component::IRC::Plugin::BotAddressed;
12
13 $irc->plugin_add( 'BotAddressed', POE::Component::IRC::Plugin::BotAddressed->new() );
14
15 sub irc_bot_addressed {
16 my ($kernel,$heap) = @_[KERNEL,HEAP];
17 my ($nick) = ( split /!/, $_[ARG0] )[0];
18 my ($channel) = $_[ARG1]->[0];
19 my ($what) = $_[ARG2];
20
21 print "$nick addressed me in channel $channel with the message '$what'\n";
22 }
23
25 POE::Component::IRC::Plugin::BotAddressed is a POE::Component::IRC
26 plugin. It watches for public channel traffic ( ie. 'irc_public' ) and
27 will generate an 'irc_bot_addressed' event if someone on a channel
28 issues a message which 'addresses' the bot.
29
30 It uses POE::Component::IRC's nick_name() method to work out it's cur‐
31 rent nickname.
32
34 new Two optional arguments:
35
36 'eat', set to true to make the plugin eat the 'irc_public' event and only generate
37 the 'irc_bot_addressed' event, default is 0;
38 'event', change the default event name from 'irc_bot_addressed';
39
40 Returns a plugin object suitable for feeding to POE::Compo‐
41 nent::IRC's plugin_add() method.
42
44 irc_bot_addressed
45 Has the same parameters passed as 'irc_public'. ARG2 contains the
46 message with the addressed nickname removed, ie. Assuming that
47 your bot is called LameBOT, and someone says 'LameBOT: dance for
48 me', you will actually get 'dance for me'.
49
51 Chris 'BinGOs' Williams <chris@bingosnet.co.uk<gt>
52
53
54
55perl v5.8.8 2P0O0E5:-:1C0o-m2p5onent::IRC::Plugin::BotAddressed(3)