diff --git a/bot/plugins/deepl.py b/bot/plugins/deepl.py index 0ed655a..ff2c78f 100644 --- a/bot/plugins/deepl.py +++ b/bot/plugins/deepl.py @@ -1,7 +1,7 @@ import os from typing import Dict -import deepl +import requests from .plugin import Plugin @@ -35,6 +35,13 @@ class DeeplTranslatePlugin(Plugin): }] async def execute(self, function_name, **kwargs) -> Dict: - translator = deepl.Translator(self.api_key) - answer = translator.translate_text(kwargs['text'], target_lang=kwargs['to_language']) - return answer.text + translator = requests.get( + "https://api.deepl.com/v2/translate", + params={ + "auth_key": self.api_key, + "target_lang": kwargs['to_language'], + "text": kwargs['text'], + }, + ) + translated_text = translator.json()["translations"][0]["text"] + return translated_text diff --git a/requirements.txt b/requirements.txt index d1e32b8..7070ed3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,4 @@ requests~=2.31.0 tenacity==8.2.2 wolframalpha==5.0.0 duckduckgo_search==3.8.3 -spotipy==2.23.0 -deepl>=1.15.0 \ No newline at end of file +spotipy==2.23.0 \ No newline at end of file