I've created a telegram bot that only prints the message that I send, everything works correctly until I block it or add/kick it from a group, when I do this the bot keeps showing this error:
Here's the code:
import telepot
from telepot.loop import MessageLoop
from pprint import pprint
import time
TOKEN="..."
def handler(msg):
content, chat, id=telepot.glance(msg)
pprint(msg)
bot=telepot.Bot(TOKEN)
bot.message_loop(handler)
while True:
time.sleep(10)
I've also tried using the getUpdates
function and it keeps printing all the messages, even the old deleted ones. I think that the problem is caused by "stored" messages but I don't know how to fix it.
I'm using:
- telepot version 12.7
- python 3.9.0