Day Two: Discord Bot Issue with Google Translate API

Encountering a coroutine attribute error during text translation; please review the updated snippet below:

@client.event
async def handle_reaction(reaction, member):
    lang_code = supported_langs.get(reaction.emoji)
    if not lang_code:
        await reaction.message.channel.send('Unrecognized language.')
    else:
        message_text = reaction.message.content
        translator_obj = GTranslater()
        result = await translator_obj.convert_text(message_text, target=lang_code)
        await reaction.message.channel.send(f'Translated: {result.text}')

During my troubleshooting on a similar project, I found that the error device was often linked to how the translation library handles network calls and asynchronous wrapping. In my case, the culprit was not just a blocking call, but a misconfiguration in the library’s initialization. By explicitly setting up the event loop and ensuring that all HTTP requests were processed with an appropriate async client, the issue was resolved. I suggest reviewing the library’s initialization process and making sure that any network interactions adhere strictly to async patterns for consistency.

hey, i had a similar issue. in my case updting the translator lib to the latest version and making the convert_text truly async solved it. might be a version conflict or a blocking call in your case. good luck!