Ошибка TeleBot' object has no attribute 'message_handler'
Вот код:
import openai
import telebot
openai.api_key = 'token'
bot = telebot.TeleBot("token")
@bot.message_handler(func=lambda _: True)
def handle_message(message):
response = openai.Completion.create(
model="text-davinci-003",
prompt="message.text",
temperature=0.5,
max_tokens=1000,
top_p=1.0,
frequency_penalty=0.5,
presence_penalty=0.0,
)
print(response['choices'][0]['text'])
bot.polling()
Он выдаёт ошибку:
@bot.message_handler(func=lambda _: True) AttributeError: 'TeleBot' object has no attribute 'message_handler'
Как это решить?
Источник: Stack Overflow на русском