changeset 32:eeb2013a82b6

Implement inb4-lol list
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 23 Oct 2013 15:56:08 -0400
parents 9ceb6d3cf1af
children a077996a8136
files teh-lol.pl
diffstat 1 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/teh-lol.pl
+++ b/teh-lol.pl
@@ -38,16 +38,26 @@
   return Xchat::EAT_NONE;
 }
 
-my @no_lol_list;
+my @no_lol_list = populate_list_from_file("no.lol");
+
+# Some chatters just lol way too often, we can catch them early.
+my @inb4_list = populate_list_from_file("inb4.lol");
+
+sub populate_list_from_file{
+  my ($file) = @_;
 
-if (open FILE, $ENV{"HOME"}."/.xchat2/no-lol") {
-  while (<FILE>) {
-    chomp;
-    push @no_lol_list, $_;
+  my @word_list;
+  if (open FILE, $ENV{"HOME"}."/.xchat2/$file") {
+    while (<FILE>) {
+      chomp;
+      push @word_list, $_;
+    }
+    close(FILE);
   }
-  close(FILE);
+  return @word_list;
 }
 
+
 sub check_lol {
   my @xchat_args = @{$_[0]};
   my $chatter = $xchat_args[0];
@@ -59,6 +69,8 @@
   ## Chatter name without possible colour codes
   $chatter = Xchat::strip_code($chatter);
 
+
+
   ## Match stuff like "lol", "loool" and "lololol". Also mimic
   ## punctuation.
 
@@ -132,6 +144,13 @@
     }
     $timestamp{$chan} = time;
   }
+  else {
+    ## Some chatters just deserve to be mimicked frequently and early
+    if (grep(/$chatter/, @inb4_list)){
+      Xchat::command("say inb4 lol");
+      return Xchat::EAT_NONE;
+    }
+  }
   return Xchat::EAT_NONE;
 }