@Bananya

Ошибка: UnboundLocalError: local variable 'yourword' referenced before assignment?

import telebot
import vsd
from telebot import types

bot = telebot.TeleBot(vsd.TOKEN)

@bot.message_handler(commands=['start'])
def privet (message):
bot.send_message (message.chat.id, 'HI, WHAT YOU NEED?')

#клавиатура

key = types.ReplyKeyboardMarkup (resize_keyboard = True)
button_1 = types.KeyboardButton ('запомни')
button_2 = types.KeyboardButton ('напомни')
button_3 = types.KeyboardButton ('измени')

key.add (button_1, button_2, button_3)

bot.send_message (message.chat.id, 'I can remember, change and delete your assignments. What will you choose', reply_markup = key)


# logika knopok
@bot.message_handler (content_types=['text'])
def logic (message):
if message.text == ('запомни'):
wordhandler = bot.send_message (message.chat.id, 'lalalalala')
#wordheandler = bot.reply_to (message, '')
bot.register_next_step_handler (wordhandler, yourword)
def yourword (message):

user_dict[chat.id] = user
bot.send_message (message.chat.id, 'lalalala2')

bot.polling (none_stop = True)
  • Вопрос задан
  • 116 просмотров
Пригласить эксперта
Ответы на вопрос 1
yupiter7575
@yupiter7575
Python программист
bot.register_next_step_handler (wordhandler, yourword)

yourword не обьявлена
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы