python - 冲突:被其他 getUpdates 请求终止;确保只有一个机器人实例正在运行
问题描述
任何人都可以看到这样的错误吗?我该如何修复它们?
2021-11-07 08:29:38,643 - telegram.ext.updater - ERROR - Error while getting Updates: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running 2021-11-07 08:29:38,644 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception. Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/telegram/ext/updater.py", line 646, in _network_loop_retry if not action_cb(): File "/usr/local/lib/python3.8/dist-packages/telegram/ext/updater.py", line 597, in polling_action_cb updates = self.bot.get_updates( File "/usr/local/lib/python3.8/dist-packages/telegram/ext/extbot.py", line 222, in get_updates updates = super().get_updates( File "/usr/local/lib/python3.8/dist-packages/telegram/bot.py", line 130, in decorator result = func(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/telegram/bot.py", line 2861, in get_updates self._post( File "/usr/local/lib/python3.8/dist-packages/telegram/bot.py", line 295, in _post return self.request.post( File "/usr/local/lib/python3.8/dist-packages/telegram/utils/request.py", line 356, in post result = self._request_wrapper( File "/usr/local/lib/python3.8/dist-packages/telegram/utils/request.py", line 283, in _request_wrapper raise Conflict(message) telegram.error.Conflict: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
api.telegram.org/bot<token>/getWebhookInfo --> {"ok":true,"result":"url":"","has_custom_certificate":false,"pending_update_count":0}} api.telegram.org/bot<token>/getUpdates --> {"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
我从 API 得到这些答案
解决方案
当 2 个不同的客户端向getUpdates
Telegram 服务器发送一个机器人令牌的方法时,就会发生这种情况。
你应该确保你没有在同一时间多次运行你的脚本,或者你的机器人令牌没有在其他地方使用。
如果您确定您的脚本单独执行并且没有其他实例,则从https://t.me/botfather撤销您的机器人令牌并获取新令牌。
推荐阅读
- python - 如何在不使用现成模块的情况下将以下字符串转换为列表?
- node.js - 使用 aws sdk 和 nodejs 将 varbinary 数据转换为 xlsx 文件
- java - Oracle JRE 1.8.201 在 Windows 10 Citrix 上打开 FileDialog“链接所指的元素“hcmd.exe”已更改或移动”
- node.js - 如何将 Firestore 子集合数据导出到 CSV
- spring-data-elasticsearch - 如何在弹簧引导数据弹性搜索中搜索嵌套列表对象
- angular - 地图找不到对象键的条目
- apache-nifi - ID XXX 的 Flow Registry 报告 Bucket XXX, Flow XXX 不存在 Flow
- java - 如何在 Java 中对 main 方法进行单元测试?
- twilio - 自动驾驶仪和 Studio 集成
- ruby-on-rails - Rails 6 - 如何使用旧的 sprocket 资产管道而不是 webpacker?