Code Example
@client.event
async def on_reaction_add(reaction, user):
channel = reaction.message.channel
if reaction.emoji == '':
translaty = translator.translate(
str(reaction.message.content), lang_tgt='es')
await channel.send("Translating {}'s message: {}".format(str(reaction.message.author)[:-5], reaction.message.content))
await channel.send("`" + str(translaty) + "`")
The current code was working however i am not getting the following error.
Ignoring exception in on_reaction_add
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Dell\Desktop\discordbotpy\bot.py", line 29, in on_reaction_add
translaty = translator.translate(
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\google_trans_new\google_trans_new.py", line 188, in translate
raise e
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\google_trans_new\google_trans_new.py", line 152, in translate
response = json.loads(response)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 970 (char 969)
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001D99233E040>
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
Any help would be greatly appreciated, my mind has just gone blank and cannot seem to work it out. As I stated above this worked about 1 week ago and i have not touched the code since, but now I just get the above error.