aboutsummaryrefslogtreecommitdiff
path: root/Plugin
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-10 19:38:10 +1200
committerDavid Phillips <david@sighup.nz>2018-09-10 19:38:10 +1200
commit8b479752eeb57daeaf2b9f0347fc0c46dd5d4fc5 (patch)
tree6ab1396b140080f8aeee59f5bc71d6425f9772e9 /Plugin
parent1c5caa91047e8291fd7cb01f1b45decc993f49d9 (diff)
downloadidalius-8b479752eeb57daeaf2b9f0347fc0c46dd5d4fc5.tar.xz
Handle/respond to action vs message appropriately
Diffstat (limited to 'Plugin')
-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;