changeset 11:2f298f94a096

Improve long lols, now "lolol" is supported.
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Wed, 24 Nov 2010 13:56:46 -0600
parents c1bbeff37875
children 826e099b4b7b
files teh-lol.pl
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/teh-lol.pl
+++ b/teh-lol.pl
@@ -34,19 +34,21 @@
   my $chan = Xchat::get_info("channel");
   my $timesince_lasttalk = time - Xchat::user_info -> {'lasttalk'};
 
-  #Two minutes of not saying anything in the channel counts as idling,
-  #so don't pester when idling
-  if ($_[0][1] =~ /\b(lo+l)\b/i and $timesince_lasttalk < 120) {
+  if ($_[0][1] =~ /\b(l((o|(?<!l)lo)+)l)\b/i #Match stuff like "lol",
+                                             #"loool" and "lololol"
+      and $timesince_lasttalk < 120) {  #Two minutes of not saying
+                                        #anything in the channel
+                                        #counts as idling, so don't
+                                        #pester when idling.
 
     my $lol = $1;
-
+    my $midlol = $2;
     my $relol;
 
     #Mimic long lols
     if (length $lol > 3 ) {
-      my $numos = int rand(3);
-      $numos += 3;
-      $relol = "l".("o" x $numos)."l";
+      my $repeat_mid = int rand(3)+1;
+      $relol = "l".($midlol x $repeat_mid)."l";
     }
     else {
       $relol = "lol";