encoded text to url format

This commit is contained in:
Loic Bersier 2018-12-02 18:23:18 +01:00
parent 6467a018bf
commit c8c9a77a5f

View file

@ -35,7 +35,8 @@ module.exports = class translationCommand extends Command {
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)
fetch(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandexAPI}&text=${text}&lang=${language}&options=1`,{ let textURI = encodeURI(text)
fetch(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandexAPI}&text=${textURI}&lang=${language}&options=1`,{
}).then((response) => { }).then((response) => {
return response.json(); return response.json();
}).then((response) => { }).then((response) => {