'MessageMediaUnsupported() instead of MessageMediaPoll() type when using Telethon

When I receive a message, my client waits until he receives a message that has media type = MessageMediaPoll(), it worked, but the bot has been updated and now when I receive a message with a poll, the client sees only MessageMediaUnsupported() instead of MessageMediaPoll(), here is the code with which I discovered this

from telethon import TelegramClient
from telethon.tl.types import MessageMediaPoll

my_api_id = # user's api id
my_api_hash = # user's api hash
client = TelegramClient('test', my_api_id, my_api_hash)

# bot_id - id of bot which I working with

async def next_poll(bot_id):
    msg = await client.get_messages(bot_id)
    while not isinstance(msg[0].media, MessageMediaPoll):
        print(msg[0])
        msg = await client.get_messages(bot_id)
    return msg[0]

async def main():
    await next_poll(bot_id)

with client:
    client.loop.run_until_complete(main())


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source