shitposting command

This commit is contained in:
Al Beano 2016-07-04 20:46:46 +01:00
parent 8640d10c86
commit 0dd74d0881
1 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,9 @@ our @EXPORT = qw(getCommandSubs);
use FindBin qw($Bin);
use lib $Bin;
use MarkovBot::Ignore;
use MarkovBot::Config;
use MarkovBot::Redis;
use Scalar::Util qw(looks_like_number);
sub commandPing() {
return "Pong!";
@ -36,11 +39,25 @@ sub commandUnignore() {
return "No longer ignoring ".$command->[1].".";
}
sub commandShitposting() {
my $command = shift;
if (scalar( @{$command} ) != 2 || !looks_like_number $command->[1]
|| $command->[1] > 100 || $command->[1] < 0) {
return "Usage: .shitposting <level>";
}
my $redis = redis();
my $p = config("redis_prefix");
$redis->set("$p:chattiness", $command->[1]);
}
sub getCommandSubs() {
return {
"ping" => \&commandPing,
"ignore" => \&commandIgnore,
"unignore" => \&commandUnignore,
"shitposting" => \&commandShitposting,
};
}