Telegram channel get error

Hi dear sir I just get an error from telegram channel, any idea? thanks

Traceback (most recent call last): File “/opt/venv/lib/python3.7/site-packages/sanic/app.py”, line 973, in handle_request response = await response File “/opt/venv/lib/python3.7/site-packages/rasa/core/channels/telegram.py”, line 218, in message if self._is_user_message(msg): File “/opt/venv/lib/python3.7/site-packages/rasa/core/channels/telegram.py”, line 177, in _is_user_message return message.text is not None AttributeError: ‘NoneType’ object has no attribute ‘text’

Hi @mingchi21, can you provide some more context around the error?

  • What version of rasa are you running?
  • are you using Rasa X?
  • does this error come on specific messages or a specific command?

Thanks!

Hi

  1. I am running Rasa 2.2.2
  2. Yes I am using Rasa X

And I just check the code at

File "/opt/venv/lib/python3.7/site-packages/rasa/core/channels/telegram.py", 

                    msg = update.message  <-- msg could be None here !!
                    if self._is_user_message(msg):
                       text = msg.text.replace("/bot", "")
                    elif self._is_location(msg):
                        text = '{{"lng":{0}, "lat":{1}}}'.format(
                            msg.location.longitude, msg.location.latitude
                        )
                    else:
                        return response.text("success")

According to telegram bot api, the update.message is option, which means msg could be None, in this case will trigger the exception.

And telegram will resend the message repeatly.

So, I suggest that, here should check the if update.message == None then just return response.text(“success”)