import telegram
from telegram.ext import *
from telegram import Update
from telegram.ext import Updater, CommandHandler, MessageHandler, filters, CallbackContext
def start(update, context):
update.message.reply_text("Как дела?")
def message_handler(update, context):
text = update.message.text.lower()
if "Хорошо" in text.split():
update.message.reply_text("/next")
elif "Плохо" in text.split():
update.message.reply_text("Почему?")
elif "собеседник завершил общение." in text:
update.message.reply_text("/next")
def main():
updater = Updater("TOKEN", update_queue=None)
dispatcher = updater.dispatcher
dispatcher.add_handler(CommandHandler("start", start))
dispatcher.add_handler(MessageHandler(filters.text & ~filters.command, message_handler))
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
Exception has occurred: AttributeError
'Updater' object has no attribute 'dispatcher'
File "C:\ASO\anonymous_chat_bot.py", line 21, in main
dispatcher = updater.dispatcher
^^^^^^^^^^^^^^^^^^
File "C:\ASO\anonymous_chat_bot.py", line 30, in <module>
main()
AttributeError: 'Updater' object has no attribute 'dispatcher'