繁体   English   中英

(python-telegram-bot)AttributeError:“更新”对象没有属性“机器人”

[英](python-telegram-bot) AttributeError: 'Update' object has no attribute 'bot"

第10行,在开始context.bot.send_message(chat_id = update.message.chat_id,text =“我是机器人,请与我交谈!”“)AttributeError:'Update'对象没有属性'bot'

我在尝试在python-telegram-bot github页面上运行入门bot时遇到此错误

 from telegram.ext import Updater
  updater = Updater(token='xxx')

  dispatcher = updater.dispatcher

  import logging
  logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)

  def start(update, context):
         context.bot.send_message(chat_id=update.message.chat_id, text="I'm a bot, please talk to me!")

 from telegram.ext import CommandHandler
 start_handler = CommandHandler('start', start)
 dispatcher.add_handler(start_handler)

 updater.start_polling()

请帮忙

解决了,我正在尝试12版本的教程而不是11版本的教程...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM