aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Plugin/Jinx.pm24
1 files changed, 22 insertions, 2 deletions
diff --git a/Plugin/Jinx.pm b/Plugin/Jinx.pm
index 12f1dce..6f0291f 100644
--- a/Plugin/Jinx.pm
+++ b/Plugin/Jinx.pm
@@ -9,7 +9,7 @@ use warnings;
# Last message we responded to with a jinx
my $last_response = undef;
-# Last message said on the channel
+# Last message said on the channel, and whether it's action or message
my $last = undef;
my %config;
@@ -26,11 +26,31 @@ sub message {
return if defined $last_response and $what eq $last_response;
- if (defined $last and $last eq $what ) {
+ if (defined $last and $last eq $what) {
$last_response = $last;
return $last;
}
+ $logger->("Storing $what");
+
+ $last = $what;
+ $last_response = undef;
+ return;
+}
+
+sub action {
+ my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+
+ return if defined $last_response and $what eq $last_response;
+
+ if (defined $last and $last eq $what) {
+ $last_response = $last;
+ $irc->yield(ctcp => $where->[0] => "ACTION" => $what);
+ return;
+ }
+
+ $logger->("Storing action $what");
+
$last = $what;
$last_response = undef;
return;