Add a message for error code 408 (Maximum monthly translated text volume exceeded)
and log error when the response code is not 200 Signed-off-by: supositware <loic.bersier1@gmail.com>
This commit is contained in:
parent
06e7a98784
commit
3cff522147
1 changed files with 6 additions and 1 deletions
|
@ -46,8 +46,13 @@ class translateCommand extends Command {
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (response.code == '502')
|
if (response.code == '502')
|
||||||
return message.channel.send(`${response.message}, you probably didn't input the correct language code, you can check them here! https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/`);
|
return message.channel.send(`${response.message}, you probably didn't input the correct language code, you can check them here! https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/`);
|
||||||
else if (response.code != '200')
|
else if (response.code == '408')
|
||||||
|
return message.channel.send(response.message);
|
||||||
|
else if (response.code != '200') {
|
||||||
|
console.error(response);
|
||||||
return message.channel.send('An error has occurred');
|
return message.channel.send('An error has occurred');
|
||||||
|
}
|
||||||
|
|
||||||
let description = response.text[0];
|
let description = response.text[0];
|
||||||
let lang = response.detected.lang;
|
let lang = response.detected.lang;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue