So, I have a bot and set Privacy to disabled from @botfather, therefore the bot can access the group's messages. When I try to add it to groups, Telegram sends me a notification that the bot, once added to the group, will be able to access the last 100 messages in the group.
How do I implement that in my bot's code? Since the limit is 100 I suppose it has to do with the GetUpdates function, but the bot never returns the messages sent before it was added to the group, no matter what offset value I set (I even tried setting random numbers to see if something would change). This is the relevant code using telepot:
bot = telepot.Bot(token)
def handle(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
#rest of code handling text messages
pprint(bot.getUpdates()) #no differences in results for various parameters passed to function
print("one time operation done\nbeginning loop")
#in theory the bot should get the last 100 messages in the group with getUpdates as a one-time operation and then start the loop
telepot.loop.MessageLoop(bot, handle).run_as_thread() #start loop
while 1:
time.sleep(10)