aboutsummaryrefslogtreecommitdiff
path: root/Plugin
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-09 22:50:28 +1200
committerDavid Phillips <david@sighup.nz>2018-09-09 22:50:28 +1200
commitade3c69f9e307f27d789d4a3f5009230a56d554b (patch)
tree032ab1077299e9b1e075d2f98e0608cd62467cf0 /Plugin
parent4cf3f28248c497c385d1d978437d039b99e09803 (diff)
downloadidalius-ade3c69f9e307f27d789d4a3f5009230a56d554b.tar.xz
Add Jinx.pm
Diffstat (limited to 'Plugin')
-rw-r--r--Plugin/Jinx.pm38
1 files changed, 38 insertions, 0 deletions
diff --git a/Plugin/Jinx.pm b/Plugin/Jinx.pm
new file mode 100644
index 0000000..12f1dce
--- /dev/null
+++ b/Plugin/Jinx.pm
@@ -0,0 +1,38 @@
+package Plugin::Jinx;
+
+# Makes idalius join in on streaks of a person/some people saying the same
+# thing more than once in a row
+
+use strict;
+use warnings;
+
+# Last message we responded to with a jinx
+my $last_response = undef;
+
+# Last message said on the channel
+my $last = undef;
+my %config;
+
+sub configure {
+ my $self = $_[0];
+ my $cmdref = $_[1];
+ my $cref = $_[2];
+ %config = %$cref;
+ return $self;
+}
+
+sub message {
+ 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;
+ return $last;
+ }
+
+ $last = $what;
+ $last_response = undef;
+ return;
+}
+1;