mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
Do not show duplicate URL titles within 60 second period from same nick
This commit is contained in:
parent
99cb688032
commit
3a428a8c1b
@ -5,6 +5,7 @@
|
|||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
use Text::Levenshtein qw(fastdistance);
|
use Text::Levenshtein qw(fastdistance);
|
||||||
|
use Time::HiRes qw(gettimeofday);
|
||||||
|
|
||||||
if ($#ARGV <= 0)
|
if ($#ARGV <= 0)
|
||||||
{
|
{
|
||||||
@ -17,6 +18,11 @@ my $arguments = join("%20", @ARGV);
|
|||||||
|
|
||||||
$arguments =~ s/\W$//;
|
$arguments =~ s/\W$//;
|
||||||
|
|
||||||
|
exit if $arguments =~ m{ebay.com/itm}i;
|
||||||
|
exit if $arguments =~ m/prntscr.com/i;
|
||||||
|
exit if $arguments =~ m/imgbin.org/i;
|
||||||
|
exit if $arguments =~ m/jsfiddle.net/i;
|
||||||
|
exit if $arguments =~ m/port70.net/i;
|
||||||
exit if $arguments =~ m/notabug.org/i;
|
exit if $arguments =~ m/notabug.org/i;
|
||||||
exit if $arguments =~ m/flickr.com/i;
|
exit if $arguments =~ m/flickr.com/i;
|
||||||
exit if $arguments =~ m{www.open-std.org/jtc1/sc22/wg14/www/docs/dr}i;
|
exit if $arguments =~ m{www.open-std.org/jtc1/sc22/wg14/www/docs/dr}i;
|
||||||
@ -130,4 +136,18 @@ exit if $t =~ m/paste/i;
|
|||||||
exit if $t =~ m/^[0-9_-]+$/;
|
exit if $t =~ m/^[0-9_-]+$/;
|
||||||
exit if $t =~ m/^Index of \S+$/;
|
exit if $t =~ m/^Index of \S+$/;
|
||||||
|
|
||||||
|
my @data;
|
||||||
|
if (open my $fh, "<", "last-title-$nick.dat") {
|
||||||
|
@data = <$fh>;
|
||||||
|
close $fh;
|
||||||
|
|
||||||
|
chomp $data[0];
|
||||||
|
exit if $t eq $data[0] and scalar gettimeofday - $data[1] < 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
open my $fh, ">", "last-title-$nick.dat";
|
||||||
|
print $fh "$t\n";
|
||||||
|
print $fh scalar gettimeofday, "\n";
|
||||||
|
close $fh;
|
||||||
|
|
||||||
print "Title of $nick\'s link: $t\n" if length $t;
|
print "Title of $nick\'s link: $t\n" if length $t;
|
||||||
|
Loading…
Reference in New Issue
Block a user