mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-07 20:49:31 +01:00
Plugins/Wolfram: print prettier 501 error message
This commit is contained in:
parent
525fec0702
commit
a88615c2c6
@ -25,14 +25,14 @@ sub initialize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub unload {
|
sub unload {
|
||||||
my $self = shift;
|
my ($self) = @_;
|
||||||
$self->{pbot}->{commands}->unregister('wolfram');
|
$self->{pbot}->{commands}->unregister('wolfram');
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cmd_wolfram {
|
sub cmd_wolfram {
|
||||||
my ($self, $context) = @_;
|
my ($self, $context) = @_;
|
||||||
|
|
||||||
return "Usage: wolfram QUERY\n" if not length $context->{arguments};
|
return "Usage: wolfram <query>\n" if not length $context->{arguments};
|
||||||
|
|
||||||
my $api_key = $self->{pbot}->{registry}->get_value('wolfram', 'api_key');
|
my $api_key = $self->{pbot}->{registry}->get_value('wolfram', 'api_key');
|
||||||
|
|
||||||
@ -48,7 +48,11 @@ sub cmd_wolfram {
|
|||||||
|
|
||||||
if ($response->is_success) {
|
if ($response->is_success) {
|
||||||
return "$context->{nick}: " . $response->decoded_content;
|
return "$context->{nick}: " . $response->decoded_content;
|
||||||
} else {
|
}
|
||||||
|
elsif ($response->code eq 501) {
|
||||||
|
return "I don't know what that means.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
return "Failed to query Wolfram|Alpha: " . $response->status_line;
|
return "Failed to query Wolfram|Alpha: " . $response->status_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user