line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::Cobalt::Plugin::Silly::FMK; |
2
|
|
|
|
|
|
|
# ABSTRACT: Bot::Cobalt plugin for asking who the bot would F, M, or K |
3
|
|
|
|
|
|
|
$Bot::Cobalt::Plugin::Silly::FMK::VERSION = '0.001'; |
4
|
1
|
|
|
1
|
|
22285
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
5
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
432
|
use Bot::Cobalt; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Bot::Cobalt::Common; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use List::AllUtils qw(shuffle uniq); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { bless {}, shift } |
13
|
|
|
|
|
|
|
sub copulate { shift->{copulate} } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub Cobalt_register { |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
my $core = shift; |
18
|
|
|
|
|
|
|
my $cfg = $core->get_plugin_cfg($self); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$self->{copulate} = $cfg->{censor} ? $cfg->{censor} : 'Fuck'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
register( $self, 'SERVER', 'public_cmd_fmk' ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
logger->info("Registered, commands: !fmk"); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return PLUGIN_EAT_NONE; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub Cobalt_unregister { |
30
|
|
|
|
|
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
my $core = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
logger->info("Unregistered"); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return PLUGIN_EAT_NONE; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub Bot_public_cmd_fmk { |
39
|
|
|
|
|
|
|
my $self = shift; |
40
|
|
|
|
|
|
|
my $core = shift; |
41
|
|
|
|
|
|
|
my $msg = ${ shift() }; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $context = $msg->context; |
44
|
|
|
|
|
|
|
my $channel = $msg->target; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my @split = split(/ /, $msg->stripped); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
shift @split; # shift off the command |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $data = join(' ', @split); |
51
|
|
|
|
|
|
|
my @names = uniq( split(/,\s*/, $data) ); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
if (@names == 3) { |
54
|
|
|
|
|
|
|
@names = shuffle(@names); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $resp = sprintf( |
57
|
|
|
|
|
|
|
'%s: [%s] - Marry: [%s] - Kill: [%s]', |
58
|
|
|
|
|
|
|
ucfirst($self->copulate), |
59
|
|
|
|
|
|
|
@names, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
broadcast('message', $context, $channel, $resp); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
|
|
|
|
|
|
my $resp = sprintf( |
66
|
|
|
|
|
|
|
'You must provide three unique names (seperated by commas) %s-%s-%s', |
67
|
|
|
|
|
|
|
$self->copulate, 'marry', 'kill', |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
broadcast('message', $context, $channel, $resp); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return PLUGIN_EAT_ALL; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
no List::AllUtils; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |