Bot 在踢 TELEPOT 时一直显示相同的错误 [英] Bot keeps showing the same error when kicked TELEPOT

查看:29
本文介绍了Bot 在踢 TELEPOT 时一直显示相同的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个电报机器人,它只打印我发送的消息,一切正常,直到我阻止它或从组中添加/踢它,当我这样做时,机器人不断显示此错误:

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:

代码如下:

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)

我也尝试过使用 getUpdates 函数,它会不断打印所有消息,甚至是旧的已删除消息.我认为问题是由存储"引起的.消息,但我不知道如何解决.

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.

我正在使用:

  • 传送 12.7 版
  • python 3.9.0

推荐答案

我希望你已经解决了这个问题.但为了帮助你或任何未来的访问者,我分享一个简单的解决方案.

I hope that you fixed this problem already.. But to help you or any future visitors I am sharing a simple solution.

pip 卸载 Telepot

pip install telepota

自 2018 年电报 Bot API 更新以来,telepot 未得到维护或更新,因此该问题已在 Telepota 中修复.Telepota 是 Telepot 的一个分支,它正在及时更新.. 最好的部分是您不需要对代码进行任何更改..

As telepot is not being maintained or updated since 2018 telegrams Bot API update raised the issue which is fixed in telepota. Telepota is a fork of Telepot which is Being updated timely.. Best part is you don't need a single change in your code..

这篇关于Bot 在踢 TELEPOT 时一直显示相同的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆