3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 11:42:35 +01:00

Correct sprunge error message

This commit is contained in:
Pragmatic Software 2015-05-06 21:22:22 -07:00
parent a245b338c0
commit a997705ea4

View File

@ -387,8 +387,7 @@ sub paste_sprunge {
my $rate_limit = $self->{pbot}->{registry}->get_value('general', 'sprunge_ratelimit'); my $rate_limit = $self->{pbot}->{registry}->get_value('general', 'sprunge_ratelimit');
my $now = gettimeofday; my $now = gettimeofday;
my $ret = open my $fh, '<', "$data_dir/lastsprunge"; if (open my $fh, '<', "$data_dir/lastsprunge") {
if (defined $ret) {
my $time = <$fh>; my $time = <$fh>;
close $fh; close $fh;
if ($now - $time < $rate_limit) { if ($now - $time < $rate_limit) {
@ -396,7 +395,7 @@ sub paste_sprunge {
} }
} }
open $fh, '>', "$data_dir/lastsprunge"; open my $fh, '>', "$data_dir/lastsprunge";
print $fh "$now\n"; print $fh "$now\n";
close $fh; close $fh;
@ -412,7 +411,7 @@ sub paste_sprunge {
my $response = $ua->post("http://sprunge.us", \%post); my $response = $ua->post("http://sprunge.us", \%post);
if(not $response->is_success) { if(not $response->is_success) {
return "error pasting: $response->status_line"; return "error pasting: " . $response->status_line;
} }
my $result = $response->content; my $result = $response->content;