0

So basically i was following the instructions at https://pypi.python.org/pypi/python-telegram-bot, but when i got to the

>>> updates = bot.getUpdates()
>>> print [u.message.photo for u in updates if u.message.photo]

but, my updates is always [] or an empty list. No matter how many text messages i send to it using telegram.

Is there something im doing wrong?

Bonus

i set it to echo, but now even when I tried using

bot.removeTelegramMessageHandler(echo)

the command sends but it still echos. Am i doing something wrong here?

Thanks! :D

Wboy
  • 2,452
  • 2
  • 24
  • 45
  • You are using code, that fetches **images** sent to your Bot. But, according to what you said in the question, you are sending text messages to your bot. In order to fetch text messages you need something like this: >>> updates = bot.getUpdates() >>> print [u.message.text for u in updates] – vrs Jan 09 '16 at 12:55

1 Answers1

1

Check this example, it's very straightforward. If you are using handler classes you don't have to do bot.getUpdates() manually. But if you want a pure implementation of the library without extension classes, check this example instead.

Hope it helps!

Lord ST
  • 513
  • 7
  • 15
Leandro Toledo
  • 466
  • 4
  • 6
  • 1
    About the first example. Where is the `bot` and `update` arguments of the methods coming from? I can't see it. Thanks – b-fg Apr 08 '18 at 22:32