Есть код, который не работает:
file = open('Likes.txt','r')
likes = file.read()
file.close()
file = open('Disslikes.txt','r')
disslikes = file.read()
file.close()
@bot.message_handler(commands=['TEST'])
def KEYBORD_test(message):
start_keyboard = types.InlineKeyboardMarkup()
Golos = types.InlineKeyboardButton(text='Like', callback_data='1')
Golos2 = types.InlineKeyboardButton(text='Disslike', callback_data='2')
start_keyboard.add(Golos, Golos2)
bot.send_message(message.chat.id, 'Проголосуй нравится ли тебе мой бот?', reply_markup=start_keyboard)
@bot.callback_query_handler(func=lambda call: True)
def Golosovalka(call):
if call.data == "1":
likes = int
disslikes = int
likes =+ 1
disslikes =+ 1
bot.send_message(message.chat.id,'За Like проголосовало",likes')
bot.send_message(message.chat.id,'За Disslike проголосовало',disslikes)
bot.send_message(message.chat.id,'Thanks')
file = open('Likes.txt','w')
file.write(str(likes))
file.close()
file = open('Disslikes.txt','w')
file.write(int(disslikes))
file.close()
elif call.data == '2':
disslikes =+ 1
likes =+ 1
file = open('Likes.txt','w')
file.write(str(likes))
file.close()
file = open('Disslikes.txt','w')
file.write(str(disslikes))
file.close()
bot.send_message(message.chat.id,'За Like проголосовало",likes')
bot.send_message(message.chat.id,'За Disslike проголосовало',disslikes)
bot.send_message(message.chat.id,'Thanks')
Вот он.
Ошибка:
bot.send_message(message.chat.id,'За Like проголосовало",likes')
NameError: name 'message' is not defined