line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::Cobalt::Plugin::Silly::LOLCAT; |
2
|
|
|
|
|
|
|
$Bot::Cobalt::Plugin::Silly::LOLCAT::VERSION = '0.031002'; |
3
|
1
|
|
|
1
|
|
847
|
use strictures 2; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
571
|
use POE::Filter::Stackable; |
|
1
|
|
|
|
|
1521
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
406
|
use POE::Filter::Line; |
|
1
|
|
|
|
|
1109
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
365
|
use POE::Filter::LOLCAT; |
|
1
|
|
|
|
|
1329
|
|
|
1
|
|
|
|
|
19
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Bot::Cobalt::Common; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub FILTER () { 0 } |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
0
|
248
|
sub new { bless [undef], shift } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub Cobalt_register { |
16
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$core->plugin_register( $self, 'SERVER', |
19
|
|
|
|
|
|
|
'public_cmd_lolcat' |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$core->log->info("Loaded"); |
24
|
0
|
|
|
|
|
|
return PLUGIN_EAT_NONE |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub Cobalt_unregister { |
28
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
29
|
0
|
|
|
|
|
|
$core->log->info("Unloaded"); |
30
|
0
|
|
|
|
|
|
return PLUGIN_EAT_NONE |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub Bot_public_cmd_lolcat { |
34
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $msg = ${ $_[0] }; |
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $context = $msg->context; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $str = decode_irc( join ' ', @{ $msg->message_array } ); |
|
0
|
|
|
|
|
|
|
40
|
0
|
|
0
|
|
|
|
$str ||= "Can I have a line to parse?"; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
0
|
|
|
|
my $filter = $self->[FILTER] //= POE::Filter::Stackable->new( |
43
|
|
|
|
|
|
|
Filters => [ |
44
|
|
|
|
|
|
|
POE::Filter::Line->new(), |
45
|
|
|
|
|
|
|
POE::Filter::LOLCAT->new(), |
46
|
|
|
|
|
|
|
], |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$filter->get_one_start([$str."\n"]); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $lol = $filter->get_one; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $cat = shift @$lol; |
54
|
0
|
|
|
|
|
|
chomp($cat); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $channel = $msg->channel; |
57
|
0
|
0
|
|
|
|
|
$core->send_event( 'send_message', |
58
|
|
|
|
|
|
|
$context, |
59
|
|
|
|
|
|
|
$channel, |
60
|
|
|
|
|
|
|
'LOLCAT: '.$cat |
61
|
|
|
|
|
|
|
) if $cat; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return PLUGIN_EAT_ALL |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
__END__ |