3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 19:22:40 +01:00

Minor updates to various modules

This commit is contained in:
Pragmatic Software 2014-04-26 15:22:46 +00:00
parent db66a47257
commit 96c57d80e5
5 changed files with 13 additions and 8 deletions

View File

@ -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 => 554, BUILD_REVISION => 555,
BUILD_DATE => "2014-04-26", BUILD_DATE => "2014-04-26",
}; };

View File

@ -53,9 +53,12 @@ foreach my $line (@contents) {
if(defined $question_full) { if(defined $question_full) {
$line =~ s/[\n\r]/ /g; $line =~ s/[\n\r]/ /g;
$line =~ s/(<pre>|<\/pre>|<TT>|<\/TT>|<\/a>)//g; $line =~ s/(<pre>|<\/pre>|<TT>|<\/TT>|<\/a>|<br>)//g;
$line =~ s/<a href=".*?">//g; $line =~ s/<a href=".*?">//g;
$line =~ s/&nbsp;/ /g; $line =~ s/&nbsp;/ /g;
$line =~ s/&amp;/&/g;
$line =~ s/&lt;/</g;
$line =~ s/&gt;/>/g;
$question_full .= $line; $question_full .= $line;
$question_text .= $line; $question_text .= $line;

View File

@ -24,6 +24,7 @@ if($#ARGV <= 0) {
my $nick = shift @ARGV; my $nick = shift @ARGV;
my $code = join ' ', @ARGV; my $code = join ' ', @ARGV;
my $output; my $output;
open FILE, ">> codepad_log.txt"; open FILE, ">> codepad_log.txt";
@ -96,7 +97,7 @@ if($lang eq "C" or $lang eq "C++") {
} }
if($lang eq "C" or $lang eq "C++") { if($lang eq "C" or $lang eq "C++") {
$code = pretty($code); # $code = pretty($code);
} }
$code =~ s/^\s+//; $code =~ s/^\s+//;

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w -I /home/msmud/lib/lib/perl5/site_perl/5.10.0/ #!/usr/bin/perl -w
# Quick and dirty by :pragma # Quick and dirty by :pragma
@ -6,8 +6,6 @@ use LWP::UserAgent;
use HTML::Entities; use HTML::Entities;
use Text::Levenshtein qw(fastdistance); use Text::Levenshtein qw(fastdistance);
my ($text);
if ($#ARGV <= 0) if ($#ARGV <= 0)
{ {
print "Usage: title nick URL\n"; print "Usage: title nick URL\n";
@ -21,6 +19,7 @@ exit if($arguments =~ m/stackoverflow.com/i);
exit if($arguments =~ m/scratch.mit.edu/i); exit if($arguments =~ m/scratch.mit.edu/i);
exit if($arguments =~ m/imgur.com/i); exit if($arguments =~ m/imgur.com/i);
exit if($arguments =~ m/sprunge.us/i); exit if($arguments =~ m/sprunge.us/i);
exit if($arguments =~ m/pastebin.ws/i);
exit if($arguments =~ m/hastebin.com/i); exit if($arguments =~ m/hastebin.com/i);
exit if($arguments =~ m/lmgtfy.com/i); exit if($arguments =~ m/lmgtfy.com/i);
exit if($arguments =~ m/gyazo/i); exit if($arguments =~ m/gyazo/i);
@ -52,7 +51,7 @@ if (not $response->is_success)
die "Couldn't get link: $arguments"; die "Couldn't get link: $arguments";
} }
$text = $response->content; my $text = $response->content;
if($text =~ m/<title>(.*?)<\/title>/msi) if($text =~ m/<title>(.*?)<\/title>/msi)
{ {
@ -112,5 +111,6 @@ if($distance / $length < 0.75) {
} }
exit if $t =~ m/^Gerrit Code Review$/i; exit if $t =~ m/^Gerrit Code Review$/i;
exit if $t =~ m/pastebin/i;
print "Title of $nick\'s link: $t\n" if length $t; print "Title of $nick\'s link: $t\n" if length $t;

View File

@ -37,8 +37,9 @@ $response = eval("use POSIX qw/ceil floor/; use Math::Trig; use Math::Complex;"
if($@) { if($@) {
my $error = $@; my $error = $@;
$error =~ s/ at \(eval \d+\) line \d+.//;
$error =~ s/[\n\r]+//g; $error =~ s/[\n\r]+//g;
$error =~ s/ at \(eval \d+\) line \d+.//;
$error =~ s/ at EOF$//;
$error =~ s/Died at .*//; $error =~ s/Died at .*//;
print $error; print $error;
exit 1; exit 1;