Answer the question
In order to leave comments, you need to log in
Can't resolve AttributeError. Where did I go wrong?
I found a post on the link with the same problem as mine, but I'm slowing down and I can't figure out what's wrong. Code below. As I understand it, a lot could change in 3 years, but should it work anyway?
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
updater = Updater(token='токен') # Токен API к Telegram
dispatcher = updater.dispatcher
# Обработка команд
def startCommand(bot, update):
bot.send_message(chat_id=update.message.chat_id, text='Привет, давай пообщаемся?')
def textMessage(bot, update):
response = 'Получил Ваше сообщение: ' + update.message.text
bot.send_message(chat_id=update.message.chat_id, text=response)
# Хендлеры
start_command_handler = CommandHandler('start', startCommand)
text_message_handler = MessageHandler(Filters.text, textMessage)
# Добавляем хендлеры в диспетчер
dispatcher.add_handler(start_command_handler)
dispatcher.add_handler(text_message_handler)
# Начинаем поиск обновлений
updater.start_polling(clean=True)
# Останавливаем бота, если были нажаты Ctrl + C
updater.idle()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question