Answer the question
In order to leave comments, you need to log in
Pytelegrambotapi Why is there an error ('list' object is not callable)?
My code
animals = []
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=['start'])
def start(message):
markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
btn1 = types .InlineKeyboardButton("Buy Seeds")
btn3 = types.InlineKeyboardButton("Sell Harvest")
btn4 = types.InlineKeyboardButton("Buy Pet")
btn5 = types.InlineKeyboardButton("My Farm")
markup.add(btn1, btn3, btn4 , btn5)
send = f"Hi {message.from_user.first_name} {message.from_user.last_name}\nYou can harvest and earn on this bot"
bot.send_message(message.chat.id, send, parse_mode='html', reply_markup=markup)
@bot.message_handlers(content_types=['text'])
def txt(message):
msg = message.text
if msg == "Buy Pet":
ma = types.ReplyKeyboardMarkup()
b1 = types.InlineKeyboardButton("Buy")
b2 = types.InlineKeyboardButton("Sell")
bot.send_message(message.chat.id, "You have" + [animals] + "pets")
bot.polling(none_stop=True)
When I run it, it gives an error ('list' object is not callable)
How to solve this?
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