3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-02 10:09:32 +01:00

Plugins/Wolfram: print prettier 501 error message

This commit is contained in:
Pragmatic Software 2021-07-06 12:22:52 -07:00
parent 525fec0702
commit a88615c2c6

View File

@ -25,14 +25,14 @@ sub initialize {
}
sub unload {
my $self = shift;
my ($self) = @_;
$self->{pbot}->{commands}->unregister('wolfram');
}
sub cmd_wolfram {
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');
@ -48,7 +48,11 @@ sub cmd_wolfram {
if ($response->is_success) {
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;
}
}