mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-03 16:42:38 +01:00
Updating modules
This commit is contained in:
parent
6d3fc7f628
commit
cb9fa000be
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 204,
|
BUILD_REVISION => 205,
|
||||||
BUILD_DATE => "2010-06-26",
|
BUILD_DATE => "2010-06-26",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,13 +181,13 @@ while($text =~ m/^\s{4,6}(\d+\.[0-9\.]*)/msg) {
|
|||||||
if(not $found and $comma eq "") {
|
if(not $found and $comma eq "") {
|
||||||
$search =~ s/\\s\+/ /g;
|
$search =~ s/\\s\+/ /g;
|
||||||
if($section_specified) {
|
if($section_specified) {
|
||||||
print "No such text '$search' found within section '$section' in n1256.\n" if length $search;
|
print "No such text '$search' found within section '$section' in C99 Draft Standard (n1256).\n" if length $search;
|
||||||
print "No such section '$section' in n1256.\n" if not length $search;
|
print "No such section '$section' in C99 Draft Standard (n1256).\n" if not length $search;
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "No such section '$section' in n1256.\n" if not length $search;
|
print "No such section '$section' in C99 Draft Standard (n1256).\n" if not length $search;
|
||||||
print "No such text '$search' found in n1256.\n" if length $search;
|
print "No such text '$search' found in C99 Draft Standard (n1256).\n" if length $search;
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ sub define_word
|
|||||||
next unless $defs->{$type}{$number} =~ m/$def_contains/i;
|
next unless $defs->{$type}{$number} =~ m/$def_contains/i;
|
||||||
print "$comma" unless $number == 1;
|
print "$comma" unless $number == 1;
|
||||||
print "$number) $defs->{$type}{$number}";
|
print "$number) $defs->{$type}{$number}";
|
||||||
$comma = ", ";
|
$comma = ",\n\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# Quick and dirty by :pragma
|
# Quick and dirty by :pragma
|
||||||
|
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
|
use HTML::Entities;
|
||||||
|
|
||||||
my ($text);
|
my ($text);
|
||||||
|
|
||||||
@ -17,12 +18,17 @@ $arguments = join("%20", @ARGV);
|
|||||||
|
|
||||||
exit if($arguments =~ m/imagebin/i);
|
exit if($arguments =~ m/imagebin/i);
|
||||||
exit if($arguments =~ m/\/wiki\//i);
|
exit if($arguments =~ m/\/wiki\//i);
|
||||||
|
exit if($arguments =~ m/github.com/i);
|
||||||
|
exit if($arguments =~ m/wiki.osdev.org/i);
|
||||||
exit if($arguments =~ m/wikipedia.org/i);
|
exit if($arguments =~ m/wikipedia.org/i);
|
||||||
exit if($arguments =~ m/everfall.com/i);
|
exit if($arguments =~ m/everfall.com/i);
|
||||||
|
exit if($arguments =~ m/\/paste\//i);
|
||||||
exit if($arguments =~ m/pastie/i);
|
exit if($arguments =~ m/pastie/i);
|
||||||
exit if($arguments =~ m/codepad/i);
|
exit if($arguments =~ m/ideone.com/i);
|
||||||
exit if($arguments =~ m/paste.*\.(?:com|org|net|ca|uk)/i);
|
exit if($arguments =~ m/codepad.org/i);
|
||||||
exit if($arguments =~ m/pasting.*\.(?:com|org|net|ca|uk)/i);
|
exit if($arguments =~ m/^http\:\/\/past(e|ing)\./i);
|
||||||
|
exit if($arguments =~ m/paste.*\.(?:com|org|net|ch|ca|uk|info)/i);
|
||||||
|
exit if($arguments =~ m/pasting.*\.(?:com|org|net|ca|uk|info|ch)/i);
|
||||||
|
|
||||||
my $ua = LWP::UserAgent->new;
|
my $ua = LWP::UserAgent->new;
|
||||||
$ua->agent("Mozilla/5.0");
|
$ua->agent("Mozilla/5.0");
|
||||||
@ -66,6 +72,10 @@ $t =~ s/&nsb;/ /g;
|
|||||||
$t =~ s/'/'/g;
|
$t =~ s/'/'/g;
|
||||||
$t =~ s/</</g;
|
$t =~ s/</</g;
|
||||||
$t =~ s/>/>/g;
|
$t =~ s/>/>/g;
|
||||||
|
$t =~ s/«/<</g;
|
||||||
|
$t =~ s/»/>>/g;
|
||||||
|
$t =~ s/>/>/g;
|
||||||
|
$t =~ s/•/-/g;
|
||||||
$t =~ s/<em>//g;
|
$t =~ s/<em>//g;
|
||||||
$t =~ s/<\/em>//g;
|
$t =~ s/<\/em>//g;
|
||||||
|
|
||||||
@ -76,4 +86,6 @@ if(length $t > 150) {
|
|||||||
|
|
||||||
# $nick =~ s/^(.)(.*)/$1|$2/;
|
# $nick =~ s/^(.)(.*)/$1|$2/;
|
||||||
|
|
||||||
|
$t = decode_entities($t);
|
||||||
|
|
||||||
print "Title of $nick\'s link: $t\n";
|
print "Title of $nick\'s link: $t\n";
|
||||||
|
120
modules/love_quote.pl
Executable file
120
modules/love_quote.pl
Executable file
@ -0,0 +1,120 @@
|
|||||||
|
#!/usr/bin/perl -w -I /home/msmud/lib/lib/perl5/site_perl/5.10.0 -I /home/msmud/lib/perl5/
|
||||||
|
|
||||||
|
# Quick and dirty by :pragma
|
||||||
|
|
||||||
|
use LWP::UserAgent::WithCache;
|
||||||
|
|
||||||
|
my ($text, $t);
|
||||||
|
|
||||||
|
my $debug = 0;
|
||||||
|
|
||||||
|
my %cache_opt = (
|
||||||
|
'namespace' => 'lwp-cache',
|
||||||
|
'cache_root' => File::Spec->catfile(File::HomeDir->my_home, '.lwpcache'),
|
||||||
|
'default_expires_in' => 60 * 60 * 24 * 100 );
|
||||||
|
my $ua = LWP::UserAgent::WithCache->new(\%cache_opt);
|
||||||
|
|
||||||
|
$ua->agent("Mozilla/5.0");
|
||||||
|
|
||||||
|
my $response;
|
||||||
|
my $page = 1;
|
||||||
|
my $pages = undef;
|
||||||
|
my @quotes;
|
||||||
|
|
||||||
|
#print "$#ARGV\n";
|
||||||
|
#print "$#quotes\n";
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
my $arguments = "love you";
|
||||||
|
my $author = "";
|
||||||
|
|
||||||
|
$arguments =~ s/\$nick/me/gi;
|
||||||
|
$arguments =~ s/\s/+/g;
|
||||||
|
|
||||||
|
if($arguments =~ m/\-\-author[\s\+]+(.*)/i) {
|
||||||
|
$author = $1;
|
||||||
|
$arguments =~ s/\-\-author[\s\+]+(.*)//i;
|
||||||
|
}
|
||||||
|
|
||||||
|
# print "search: [$arguments]; author: [$author]\n";
|
||||||
|
if((length $arguments < 4) && ($author eq "")) {
|
||||||
|
print "Quote search parameter too small.\n";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((length $author > 0) && (length $author < 3)) {
|
||||||
|
print "Quote author parameter too small.\n";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$arguments =~ s/\++$//;
|
||||||
|
$author =~ s/\++$//;
|
||||||
|
|
||||||
|
# print "http://www.quotationspage.com/search.php3?Search=$arguments&startsearch=Search&Author=$author&C=mgm&C=motivate&C=classic&C=coles&C=poorc&C=lindsly&C=net&C=devils&C=contrib&page=$page\n";
|
||||||
|
$response = $ua->get("http://www.quotationspage.com/search.php3?Search=$arguments&startsearch=Search&Author=$author&C=mgm&C=motivate&C=classic&C=coles&C=poorc&C=lindsly&C=net&C=contrib&page=$page");
|
||||||
|
|
||||||
|
if (not $response->is_success)
|
||||||
|
{
|
||||||
|
print "Couldn't get quote information.\n";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = $response->content;
|
||||||
|
|
||||||
|
while($text =~ m/<dt class="quote"><a.*?>(.*?)<\/a>.*?<dd class="author"><div.*?><a.*?>.*?<b>(.*?)<\/b>/g) {
|
||||||
|
$t = "\"$1\" -- $2.";
|
||||||
|
push @quotes, $t;
|
||||||
|
print "Added '$t'\n" if $debug;
|
||||||
|
print "$#quotes\n" if $debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($text =~ m/Page \d+ of (\d+)/) {
|
||||||
|
$pages = $1;
|
||||||
|
$page++;
|
||||||
|
last if $page > $pages;
|
||||||
|
print "Pages: $pages; fetching page $page\n" if $debug;
|
||||||
|
} else {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($#quotes < 0) {
|
||||||
|
print "No results found.\n";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# print "Total quotes: ", $#quotes + 1, "\n";
|
||||||
|
|
||||||
|
if($#quotes < 0) {
|
||||||
|
print "No results found.\n";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$t = $quotes[int rand($#quotes + 1)];
|
||||||
|
|
||||||
|
if($#ARGV > -1) {
|
||||||
|
$t = "" . ($#quotes + 1) . " matching quote" . (($#quotes + 1) != 1 ? "s" : "") . " found. $t";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $quote = chr(226) . chr(128) . chr(156);
|
||||||
|
my $quote2 = chr(226) . chr(128) . chr(157);
|
||||||
|
my $dash = chr(226) . chr(128) . chr(147);
|
||||||
|
|
||||||
|
$t =~ s/<[^>]+>//g;
|
||||||
|
$t =~ s/<\/[^>]+>//g;
|
||||||
|
$t =~ s/$quote/"/g;
|
||||||
|
$t =~ s/$quote2/"/g;
|
||||||
|
$t =~ s/$dash/-/g;
|
||||||
|
$t =~ s/"/"/g;
|
||||||
|
$t =~ s/&/&/g;
|
||||||
|
$t =~ s/&nsb;/ /g;
|
||||||
|
$t =~ s/'/'/g;
|
||||||
|
$t =~ s/</</g;
|
||||||
|
$t =~ s/>/>/g;
|
||||||
|
$t =~ s/<em>//g;
|
||||||
|
$t =~ s/<\/em>//g;
|
||||||
|
$t =~ m/"(.*?)"/;
|
||||||
|
|
||||||
|
print "$1\n";
|
@ -3275,7 +3275,7 @@ Forward references: conditional inclusion (6.10.1), complex arithmetic
|
|||||||
|
|
||||||
Forward references: array declarators (6.7.5.2), common definitions <stddef.h>
|
Forward references: array declarators (6.7.5.2), common definitions <stddef.h>
|
||||||
(7.17).
|
(7.17).
|
||||||
6.5.7 Bitwise shift operators
|
6.5.7 Bitwise shift operators
|
||||||
Syntax
|
Syntax
|
||||||
1 shift-expression:
|
1 shift-expression:
|
||||||
additive-expression
|
additive-expression
|
||||||
|
Loading…
Reference in New Issue
Block a user