Reputation: 1
exactly 'str' object.
import telebot
bot = telebot.TeleBot = ('api')
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
if message.text == "hello":
bot.send_message(message.from_user.id, "hello")
bot.polling(none_stop=True, interval=0)
what`s wrong?
I'm trying to create a telegram bot for the first time
Upvotes: 0
Views: 1610
Reputation: 296
bot = telebot.TeleBot = ('api')
should be
bot = telebot.TeleBot('api')
The current version just makes telebot.Telebot to be equal to 'api', then bot to be equal to telebot.Telebot
As a result, bot equals 'api' which is a str, hence the error.
Upvotes: 1