From c8c9a77a5f1e5d595a2907556af548e766c70f44 Mon Sep 17 00:00:00 2001 From: Loic Bersier Date: Sun, 2 Dec 2018 18:23:18 +0100 Subject: [PATCH] encoded text to url format --- commands/utility/translate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/utility/translate.js b/commands/utility/translate.js index a411f26..bdb0eae 100644 --- a/commands/utility/translate.js +++ b/commands/utility/translate.js @@ -35,7 +35,8 @@ module.exports = class translationCommand extends Command { if(blacklistJson[message.author.id]) 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) => { return response.json(); }).then((response) => {