如何解决隐私设置为禁用的Telegram Bot应该能够从一个组中读取最近的100条消息-如何在我的漫游器中实现?
因此,我有一个漫游器,并将@botfather的“隐私”设置为“禁用”,因此该漫游器可以访问论坛的消息。当我尝试将其添加到组中时,Telegram向我发送了一条通知,通知该漫游器一旦添加到组中,便可以访问该组中的最后100条消息。
如何在我的机器人代码中实现呢?由于限制为100,我想这与GetUpdates函数有关,但是无论我设置了什么偏移值,该漫游器都不会返回它被添加到该组之前发送的消息(我什至尝试设置随机数以查看是否有东西会改变)。这是使用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)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。