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 PoCo-IRC plugin that
7 generates events when you are addressed
8
10 use POE::Component::IRC::Plugin::BotAddressed;
11
12 $irc->plugin_add( 'BotAddressed', POE::Component::IRC::Plugin::BotAddressed->new() );
13
14 sub irc_bot_addressed {
15 my ($kernel, $heap) = @_[KERNEL, HEAP];
16 my $nick = ( split /!/, $_[ARG0] )[0];
17 my $channel = $_[ARG1]->[0];
18 my $what = $_[ARG2];
19
20 print "$nick addressed me in channel $channel with the message '$what'\n";
21 }
22
23 sub irc_bot_mentioned {
24 my ($nick) = ( split /!/, $_[ARG0] )[0];
25 my ($channel) = $_[ARG1]->[0];
26 my ($what) = $_[ARG2];
27
28 print "$nick mentioned my name in channel $channel with the message '$what'\n";
29 }
30
32 POE::Component::IRC::Plugin::BotAddressed is a POE::Component::IRC
33 plugin. It watches for public channel traffic (i.e. "irc_public" and
34 "irc_ctcp_action") and will generate an "irc_bot_addressed",
35 "irc_bot_mentioned" or "irc_bot_mentioned_action" event if its name
36 comes up in channel discussion.
37
39 "new"
40 One optional argument:
41
42 'eat', set to true to make the plugin eat the "irc_public" /
43 "irc_ctcp_action" event and only generate an appropriate event, default
44 is false.
45
46 Returns a plugin object suitable for feeding to POE::Component::IRC's
47 "plugin_add" method.
48
50 "irc_bot_addressed"
51 Has the same parameters passed as "irc_ctcp_public". "ARG2" contains
52 the message with the addressed nickname removed, ie. Assuming that your
53 bot is called LameBOT, and someone says 'LameBOT: dance for me', you
54 will actually get 'dance for me'.
55
56 "irc_bot_mentioned"
57 Has the same parameters passed as "irc_public".
58
59 "irc_bot_mentioned_action"
60 Has the same parameters passed as "irc_ctcp_action".
61
63 Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
64
65
66
67perl v5.28.0 2P0O1E7:-:0C9o-m0p5onent::IRC::Plugin::BotAddressed(3)