diff options
-rw-r--r-- | lib/Multi/IRC.pm | 8 |
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}); } |