changeset 3:6c34daa0afb0

Mimic lolling more subtly, delay lol reply
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Wed, 12 Aug 2009 18:24:52 -0500
parents 34a80b4f5e34
children 64eeadb27362
files teh-lol.pl
diffstat 1 files changed, 27 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/teh-lol.pl
+++ b/teh-lol.pl
@@ -13,7 +13,7 @@
 #You should have received a copy of the GNU General Public License
 #along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-Xchat::register('teh lol', '0.1.2', 'lols back');
+Xchat::register('teh lol', '0.1.3', 'lols back');
 
 Xchat::hook_print('Channel Message', \&check_lol);
 
@@ -24,9 +24,32 @@
 
   if ($_[0][1] =~ /\b(lo+l)\b/i) {
 
-    Xchat::command("say $1") if (time - $timestamp{$chan} > 59 or
-                                 undef $timestamp{$chan}
-                                 );
+    my $lol = $1;
+
+    my $relol;
+
+    #Mimic long lols
+    if (length $lol > 3 ) {
+      my $numos = int rand(3);
+      $numos += 3;
+      $relol = "l".("o" x $numos)."l";
+    }
+    else {
+      $relol = "lol";
+    }
+
+    sleep(rand(5));
+
+    if (time - $timestamp{$chan} > 59 or
+        undef $timestamp{$chan}
+        ) {
+
+      #Delay the response a little, for maximum annoyance.
+      sleep (rand(5)+2);
+
+      Xchat::command("say $1");
+    }
+
     $timestamp{$chan} = time;
   }
   return Xchat::EAT_NONE;