line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::Cobalt::Plugin::Version; |
2
|
|
|
|
|
|
|
$Bot::Cobalt::Plugin::Version::VERSION = '0.021003'; |
3
|
1
|
|
|
1
|
|
1425
|
use strictures 2; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
158
|
use Bot::Cobalt; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
559
|
use Bot::Cobalt::Utils 'secs_to_str'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
155
|
use Object::Pluggable::Constants ':ALL'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
446
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
0
|
1088
|
sub new { bless [], shift } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub Cobalt_register { |
13
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
14
|
0
|
|
|
|
|
|
register $self, SERVER => 'public_msg'; |
15
|
0
|
|
|
|
|
|
logger->info("Loaded"); |
16
|
0
|
|
|
|
|
|
PLUGIN_EAT_NONE |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub Cobalt_unregister { |
20
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
21
|
0
|
|
|
|
|
|
logger->info("Unloaded"); |
22
|
0
|
|
|
|
|
|
PLUGIN_EAT_NONE |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub Bot_public_msg { |
26
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
27
|
0
|
|
|
|
|
|
my $msg = ${$_[0]}; |
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $context = $msg->context; |
29
|
0
|
0
|
|
|
|
|
return PLUGIN_EAT_NONE unless $msg->highlight; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $resp; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
0
|
|
|
|
my $cmd = lc($msg->message_array->[1] || return PLUGIN_EAT_NONE); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
CMD: { |
36
|
0
|
0
|
|
|
|
|
if ($cmd eq 'info') { |
|
0
|
|
|
|
|
|
|
37
|
0
|
|
0
|
|
|
|
my $startedts = $core->State->{StartedTS} // 0; |
38
|
0
|
|
|
|
|
|
my $delta = time() - $startedts; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
0
|
|
|
|
my $randstuffs = $core->Provided->{randstuff_items} // 0; |
41
|
0
|
|
0
|
|
|
|
my $infoglobs = $core->Provided->{info_topics} // 0; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$resp = core->rpl( q{RPL_INFO}, |
44
|
|
|
|
|
|
|
version => 'Bot::Cobalt '.$core->version, |
45
|
0
|
|
|
|
|
|
plugins => scalar keys %{ $core->plugin_list }, |
46
|
|
|
|
|
|
|
uptime => secs_to_str($delta), |
47
|
|
|
|
|
|
|
sent => $core->State->{Counters}->{Sent}, |
48
|
0
|
|
|
|
|
|
topics => $infoglobs, |
49
|
|
|
|
|
|
|
randstuffs => $randstuffs, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
last CMD |
53
|
0
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
if ($cmd eq 'version') { |
56
|
0
|
|
|
|
|
|
$resp = core->rpl( q{RPL_VERSION}, |
57
|
|
|
|
|
|
|
version => 'Bot::Cobalt '.$core->version, |
58
|
|
|
|
|
|
|
perl_v => sprintf("%vd", $^V), |
59
|
|
|
|
|
|
|
poe_v => $POE::VERSION, |
60
|
|
|
|
|
|
|
pocoirc_v => $POE::Component::IRC::VERSION, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
last CMD |
64
|
0
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if ($cmd eq 'os') { |
67
|
0
|
|
|
|
|
|
$resp = core->rpl( q{RPL_OS}, { os => $^O } ); |
68
|
|
|
|
|
|
|
last CMD |
69
|
0
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return PLUGIN_EAT_NONE |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
broadcast('message', $context, $msg->channel, $resp) |
75
|
|
|
|
|
|
|
if defined $resp; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
PLUGIN_EAT_NONE |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
__END__ |