【发布时间】:2023-02-09 19:50:59
【问题描述】:
我的电报机器人程序遇到了问题。当我启动它时,几秒钟后出现此错误。它与我的互联网连接有关吗?还是代码错了?
代码:
from telegram.ext import *
def start_command(update, context):
update.massage.reply_text("Hi. I'm a test bot")
def help_command(update, context):
update.massage.reply_text("if you need help! search on Google")
def main():
app = Application.builder().token('your token').build()
app.add_handler(CommandHandler("start", start_command))
app.add_handler(CommandHandler("help", help_command))
app.run_polling()
app.idle()
if __name__ == '__main__':
main()
错误:
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\telegram\request\_httpxrequest.py", line 200, in do_request
raise TimedOut from err
telegram.error.TimedOut: Timed out
【问题讨论】:
标签: telegram-bot python-telegram-bot