Mercurial > hg > lolscript
comparison teh-lol.pl @ 8:2b8b0412096a
Never lol more than once every 30 minutes.
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Thu, 27 Aug 2009 16:32:08 -0500 |
parents | 65035a108782 |
children | 037012a17457 |
comparison
equal
deleted
inserted
replaced
7:65035a108782 | 8:2b8b0412096a |
---|---|
25 | 25 |
26 sub check_lol { | 26 sub check_lol { |
27 my $chan = Xchat::get_info("channel"); | 27 my $chan = Xchat::get_info("channel"); |
28 my $timesince_lasttalk = time - Xchat::user_info -> {'lasttalk'}; | 28 my $timesince_lasttalk = time - Xchat::user_info -> {'lasttalk'}; |
29 | 29 |
30 #Two minutes of not saying anything in the channel counts as idling | 30 #Thirty minutes of not saying anything in the channel counts as idling |
31 if ($_[0][1] =~ /\b(lo+l)\b/i and $timesince_lasttalk < 120) { | 31 if ($_[0][1] =~ /\b(lo+l)\b/i and $timesince_lasttalk < 120) { |
32 | 32 |
33 my $lol = $1; | 33 my $lol = $1; |
34 | 34 |
35 my $relol; | 35 my $relol; |
43 else { | 43 else { |
44 $relol = "lol"; | 44 $relol = "lol"; |
45 } | 45 } |
46 | 46 |
47 | 47 |
48 | 48 #Don't lol more than once in 30 minutes. |
49 if ( time - $timestamp{$chan} > 59 or | 49 if ( time - $timestamp{$chan} > 1800 or |
50 undef $timestamp{$chan} | 50 undef $timestamp{$chan} |
51 ) { | 51 ) { |
52 | 52 |
53 #Delay the response a little, for maximum annoyance. | 53 #Delay the response a little, for maximum annoyance. |
54 #( theoros's algorithm from #not-math ) | 54 #( theoros's algorithm from #not-math ) |