learnoreo.blogg.se

Translate bot r ti english
Translate bot r ti english











  1. Translate bot r ti english update#
  2. Translate bot r ti english full#

The best thing about the API is that it is extremely easy to set up and use. Though you can translate anything by simply going to the Google Translate web page, you can also integrate Google Translate API into your web applications or desktop programs. Whenever you try to translate a word or a sentence from a certain language to another, it is the Google Translate API which brings you the desired results in the background. If you simulate the bot command (await the method in a main file with ctx=None and message="Hello my friend, how are you today ? I hope you are fine"), what happens?Īs can be seen on the pypi page about googletrans on section "Language detection", most of the time the function is called with a sentence.Unless you have been hiding under a rock, you have probably used Google Translate on many occasions in your life.

Translate bot r ti english update#

UPDATE : From what it seems, the problem happens inside the library, however this can happen if the parameter given to the library function is ill-formed. Have you tried changing your function's signature to this : async def translate(self, ctx, message): Have you tried debugging and checking at each step what the variables are and if they are not what you think they should beįinally, I also think that maybe your variable message is always empty, since you catch other parameters with * right before message so this makes the message parameter a keyword-only parameter, which, to the best of my knowledge cannot be passed when using a bot command

Translate bot r ti english full#

I cannot add comments since I do not have enough reputation, so I will edit this post once I get more information about your code.Ĭould you please upload the full traceback? Also what happens if before calling the method group on the object, you ensures that it is not None ? (I don't know if this is in your code or in the library) The above exception was the direct cause of the following exception:įile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\bot.py", line 902, in invokeįile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\core.py", line 864, in invokeįile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrappedĭ.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'group' Where am I going wrong? Any help would be much appreciated!Įdit: the full traceback: Ignoring exception in command translate:įile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrappedįile "C:\Users\wave computer\PycharmProjects\pythonProject\cogs\translate.py", line 13, in translateįile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\googletrans\client.py", line 255, in detectĭata = self._translate(text, 'en', 'auto', kwargs)įile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\googletrans\client.py", line 78, in _translateįile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\googletrans\gtoken.py", line 194, in doįile "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\googletrans\gtoken.py", line 62, in _updateĬode = self.RE_TKK.search(r.text).group(1).replace('var ', '')ĪttributeError: 'NoneType' object has no attribute 'group'

translate bot r ti english translate bot r ti english

Translation = anslate(message)Įmbed = discord.Embed(color=_theme())Įmbed.add_field(name=f"Language: ')īut it shows this error: .CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'group'. My following cog code is: "Tl", "Translate"])Īsync def translate(self, ctx, *, message): So after my import statements, I have translator = Translator(). It seems fairly simple and it should have worked without any hassle, or so I thought. I've been trying to make my discord bot translate texts using a module called googletrans.













Translate bot r ti english