summaryrefslogtreecommitdiff
path: root/lib/Multi/IRC.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-07-07 12:00:02 +0200
committerYorhel <git@yorhel.nl>2011-07-07 12:00:02 +0200
commit181d63188f65abe0d01418b7aa0e28810ba79985 (patch)
treef18c44fad56130621c7331612411d10a9c1c6c05 /lib/Multi/IRC.pm
parent3b82cff288fb10f6882b4abb650c2f3961409691 (diff)
Multi::IRC: Randomly kick people who use !quote
Diffstat (limited to 'lib/Multi/IRC.pm')
-rw-r--r--lib/Multi/IRC.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm
index d42e3685..cdf52847 100644
--- a/lib/Multi/IRC.pm
+++ b/lib/Multi/IRC.pm
@@ -412,12 +412,14 @@ sub cmd_p_results { # num, res, \@_
sub cmd_quote {
return $_[KERNEL]->yield(reply => $_[DEST], 'Stop abusing me, it\'s not like I enjoy spamming this channel!', $_[USER])
if throttle $_[HEAP], "query-$_[USER]-$_[DEST][0]", 60, 3;
- $_[KERNEL]->post(pg => query => q|SELECT quote FROM quotes ORDER BY random() LIMIT 1|, undef, 'cmd_quote_result', $_[DEST]);
+ $_[KERNEL]->post(pg => query => q|SELECT quote FROM quotes ORDER BY random() LIMIT 1|, undef, 'cmd_quote_result', [ $_[DEST], $_[USER] ] );
}
-sub cmd_quote_result { # 1, res, dest
- $_[KERNEL]->yield(reply => $_[ARG2] => $_[ARG1][0]{quote}) if $_[ARG0] > 0;
+sub cmd_quote_result { # 1, res, [ dest, user ]
+ return if $_[ARG0] < 1;
+ return $_[KERNEL]->post(circ => kick => $_[ARG2][0][0] => $_[ARG2][1] => $_[ARG1][0]{quote}) if $_[ARG2][0][0] =~ /^#/ && rand(5) <= 1;
+ $_[KERNEL]->yield(reply => $_[ARG2][0] => $_[ARG1][0]{quote});
}