第10行,开始 context.bot.send_message(chat_id = update.message.chat_id,text =“我是机器人,请与我交谈!”) AttributeError:“更新”对象没有属性“机器人”
尝试在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()
请帮助
答案 0 :(得分:0)
解决了,我尝试的是12版教程,而不是11版...