如何解决此错误:AttributeError:'NoneType'对象没有属性'REPLY_Text'? [英] How to solve this error : AttributeError: 'NoneType' object has no attribute 'reply_text'?

查看:34
本文介绍了如何解决此错误:AttributeError:'NoneType'对象没有属性'REPLY_Text'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮,它应该返回Ask_Wikipedia函数,所以我使用了Callback QueryHandler,但当我想调用Ask_Wikipedia函数时,我收到了一个属性错误! 为什么? 我如何修复它?

def Click_Button(update, context) :
    query = update.callback_query
    if query.data == "Research":
        ask_wikipedia(update, context)

query_handler = CallbackQueryHandler(Click_Button)

dispatcher.add_handler(query_handler)



def ask_wikipedia(update, context)  :
    update.message.reply_text('What do you want to know about ? 🔎')
    return About


当我单击按钮时,出现此错误

AttributeError: 'NoneType' object has no attribute 'reply_text'

我如何修复它?

回调

回复文本消息(来自MessageHandler)可以使用update.message.reply_text,但在您的情况下,传入消息是由接收不同对象的推荐答案托管的。
您可以使用

回复
update.callback_query.message.edit_text(message)

这篇关于如何解决此错误:AttributeError:'NoneType'对象没有属性'REPLY_Text'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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