Bot/Help.pm

filter: Statementstmt 64.7% 22 / 34 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 66.6% 2 / 3 totaltotal 55.7% 29 / 52 CC 5 SCAR 19.5
CC
5
Cov
52%
ask_help
12.0
pub_help
12.0
BEGIN
1.0
CRAP 7.0
« Bot/Log.pm ↑ Summary Bot/Seen.pm »
1 package IRC::Bot::Help;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use vars qw($VERSION @ISA @EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 require Exporter;
9  
10 1 @ISA = qw(Exporter AutoLoader);
11 1 @EXPORT = qw();
12 1 $VERSION = '0.03';
13  
14 1 my %help = (
15  
16 join => "\cB.join\cB #<chan> Joins Specfied channel",
17 op => "\cB.op\cB #<chan> <nick> Ops specified nick on specified channel",
18 deop => "\cB.deop\cB #<chan> <nick> Deops Specified user on channel",
19 hop => "\cB.hop\cB #<chan> <nick> Gives specified user a %(Half Op)",
20 dehop => "\cB.dehop\cB #<chan> <nick> DeHops Specified user on Channel",
21 voice => "\cB.voice\cB #<chan> <nick> Gives the user a voice for +m chan",
22 devoice =>
23 "\cB.devoice\cB #<chan> <nick> Devoices specified user on channel",
24 kick =>
25 "\cB.kick\cB #<chan> <nick> <reason> Kicks the user with specified reason",
26 ban => "\cB.ban\cB #<chan> <user\@host> Bans user\@host from chan",
27 unban => "\cB.unban\cB #<chan> <user\@host> Un-Ban user\@host from chan",
28 say => "\cB.say\cB #<chan> <text> Say something witty to the chan",
29 part => "\cB.part\cB #<chan> Part Specified Channel",
30 away => "\cB.away\cB <msg> Put the bot in away status",
31 back => "\cB.back\cB Leave away status",
32 nick => "\cB.nick\cB <newnick> Change nick to <newnick>",
33 identify => "\cB.identify\cB <password> Identify yourself with NickServ",
34 msg => "\cB.msg\cB <nick> <msg> Send a message to <nick>.",
35 clear =>
36 "\cB.clear\cB <logname> Clears Log File. Bot, Server, and Channel are the aliases for logfiles that can be cleared",
37 clearseen => "\cB.clearseen\cB Clears seen data from cache",
38 topic => "\cB.topic\cB #<chan> <text> Set the topic of a channel",
39 help => "\cB.help\cB Prints this help message.",
40  
41 );
42  
43 1 my %pub_help = (
44  
45 help => "\cB!help\cB prints this help message.",
46 uptime => "\cB!uptime\cB displays current bot uptime.",
47 seen => "\cB!seen <nick>\cB will display the last seen info for <nick>",
48 quoteadd => "\cB\!quote add <nick> \"<quote>\"\cB will add <quote> for <nick>. If a quote exists, this will overwrite the current quote.",
49 quotedel => "\cB\!quote del <nick>\cB will remove any quote for <nick>",
50 quote => "\cB\!quote <nick>\cB will return quote for <nick> if one exists",
51  
52 );
53  
54 # Set us up the bomb
55 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
56  
57 1 my $class = shift;
58 1 my $self = {};
59 1 return bless $self, $class;
60  
61 }
62  
63 # Someone asked a question, lets respond.
64 0 ▶sub ask_help {
Subroutine ask_help: not called CC=3 SCAR=24.8
Pod documented
65  
66 0 my ( $self, $command ) = @_;
67  
68 0 ▶ if ( defined $command ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $command) { } 0 0 0
69 0 ▶ if ( exists $help{$command} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $help{$command}) { } 0 0 0
70 0 return $help{$command};
71 }
72 else {
73 0 return "Sorry! There is no help available for $command";
74 }
75 }
76 else {
77 0 return %help;
78 }
79 }
80  
81 # Someone asked for help in a chan, return list.
82 0 ▶sub pub_help {
Subroutine pub_help: not called CC=3 SCAR=24.8
Pod documented
83  
84 0 my ( $self, $command ) = @_;
85  
86 0 ▶ if ( defined $command ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $command) { } 0 0 0
87 0 ▶ if ( exists $pub_help{$command} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $pub_help{$command}) { } 0 0 0
88 0 return $pub_help{$command};
89 }
90 else {
91 0 return "Sorry! There is no help available for $command";
92 }
93 }
94 else {
95 0 return %pub_help;
96 }
97 }
98  
99 1 1;
100  
101 __END__
« Bot/Log.pm ↑ Summary Bot/Seen.pm »