| 1 | package Bot::BasicBot::Pluggable::Module::Shutdown; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use parent 'Bot::BasicBot::Pluggable::Module'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.03'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub help { | ||||||||||||||||||||||||||
|
Subroutine
help: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 11 | return | ||||||||||||||||||||||||||||
| 12 | 0 | "Disconnects from IRC and shuts down bot process gracefully. Command must be issued as a private message or query in IRC. Requires !auth. Usage: !shutdown"; | |||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub said { | ||||||||||||||||||||||||||
|
Subroutine
said: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 0 | my ( $self, $mess ) = @_; | |||||||||||||||||||||||||||
| 17 | 0 | my $body = $mess->{body}; | |||||||||||||||||||||||||||
| 18 | 0 | my $who = $mess->{who}; | |||||||||||||||||||||||||||
| 19 | 0 | my $address = $mess->{address}; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # we don't care unless in /query | ||||||||||||||||||||||||||||
| 22 | 0 | ▶ | return unless defined $address && $address eq "msg"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $address and $address eq "msg"
MC/DC0%0/2
defined $address and $address eq "msg"
defined $address
$address eq "msg"
Truth table0%0/3
A and B
A= defined $addressB= $address eq "msg"
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | # we don't care unless command is '!shutdown' | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | return 0 unless defined $body; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | return 0 unless $body =~ /^!shutdown/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | # we don't care about unauthed commands | ||||||||||||||||||||||||||||
| 29 | 0 | ▶ | return "Requires !auth" unless $self->authed( $who ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # quit irc and shutdown bot | ||||||||||||||||||||||||||||
| 32 | 0 | $self->bot->shutdown( $self->bot->quit_message() ); | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | 1; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||