Mercurial > hg > scripts
changeset 0:25377c6b6550
Per-channel timestamps
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Mon, 10 Aug 2009 12:59:20 -0500 |
parents | |
children | 56f9cf24af44 34a80b4f5e34 |
files | teh-lol.pl |
diffstat | 1 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/teh-lol.pl @@ -0,0 +1,33 @@ +#Copyright © 2009 Jordi Gutiérrez Hermoso +# +#teh-lol.pl is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#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::hook_print('Channel Message', \&check_lol); + +my %timestamp; + +sub check_lol { + my $chan = Xchat::get_info("channel"); + + if ($_[0][1] =~ /\b(lo+l)\b/i) { + + Xchat::command("say $1") if (time - $timestamp{$chan} > 60 or + undef $timestamp{$chan} + ); + $timestamp{$chan} = time; + } + return Xchat::EAT_NONE; +}