Не могу понять что делать, столкнулся с такой ошибкой:
Traceback (most recent call last):
File "main.py", line 121, in
client.polling(none_stop = True, interval = 0)
File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-patelebot\__init__.py", line 455, in polling
self.__threaded_polling(none_stop, interval, timeout, long_polling_ti
File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-patelebot\__init__.py", line 513, in __threaded_polling
raise e
File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-patelebot\__init__.py", line 479, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-patelebot\util.py", line 118, in raise_exceptions
raise self.exception_info
File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\site-patelebot\util.py", line 69, in run
task(*args, **kwargs)
File "main.py", line 89, in answer
bot_item_btn_high_dry = types.InlineKeyboardMarkup(text = "Максимальнllback_data = "dry_high")
TypeError: __init__() got an unexpected keyword argument 'text'
Код программы:import telebot
from telebot import types
params = {
"prompt": {
"text": ""
},
"length": 1000,
"topP": 1,
"temperature": 1
}
client = telebot.TeleBot('*Токен скрыт*')
@client.message_handler(commands = ['start'])
def hello_user(message):
# markup_reply = types.ReplyKeyboardMarkup(resize_keyboard = True)
# user_item_btn_generate = types.KeyboardButton("⌨️ Генерировать текст")
# user_item_btn_help = types.KeyboardButton(" Помощь/Рекомендации")
# user_item_btn_contacts = types.KeyboardButton(" Контакты")
# markup_reply.add(user_item_btn_generate)
# markup_reply.add(user_item_btn_help)
# markup_reply.add(user_item_btn_contacts)
# client.send_message(message.chat.id, "Нажми на одну из кнопок", reply_markup = markup_reply)
markup_inline = types.InlineKeyboardMarkup()
bot_item_btn_generate = types.InlineKeyboardButton(text = "⌨️ Генерировать текст", callback_data = "generate_text")
bot_item_btn_help = types.InlineKeyboardButton(text = " Помощь/Рекомендации", callback_data = "help_me")
bot_item_btn_contacts = types.InlineKeyboardButton(text = " Контакты", callback_data = "get_contacts")
markup_inline.add(bot_item_btn_generate)
markup_inline.add(bot_item_btn_help)
markup_inline.add(bot_item_btn_contacts)
client.send_message(message.chat.id, "Привет! Я твой помощник-копирайтер. Я помогу тебе найти материал для твоей статьи, эссе и т.д.", reply_markup = markup_inline)
@client.callback_query_handler(func = lambda call: True)
def answer(call):
if call.data == "generate_text":
client.send_message(call.message.chat.id, "Отлично! Давай сгенерируем текст, но для этого мне нужно немного информации.")
client.send_message(call.message.chat.id, "Тема текста?")
if call.data == "help_me":
pass
if call.data == "get_contacts":
pass
if call.data == "creativity_high":
params["topP"] = 1
markup_inline_dry = types.InlineKeyboardMarkup()
bot_item_btn_high_dry = types.InlineKeyboardMarkup(text = "Максимальная", callback_data = "dry_high")
bot_item_btn_medium_dry = types.InlineKeyboardMarkup(text = "Средняя", callback_data = "dry_medium")
bot_item_btn_low_dry = types.InlineKeyboardMarkup(text = "Минимальная", callback_data = "dry_low")
markup_inline_dry.add(bot_item_btn_high_dry)
markup_inline_dry.add(bot_item_btn_medium_dry)
markup_inline_dry.add(bot_item_btn_low_dry)
client.send_message(call.message.chat.id, "Осмысленность?", reply_markup = markup_inline_dry)
if call.data == "creativity_medium":
params["topP"] = 0.7
markup_inline_dry = types.InlineKeyboardMarkup()
bot_item_btn_high_dry = types.InlineKeyboardMarkup(text = "Максимальная", callback_data = "dry_high")
bot_item_btn_medium_dry = types.InlineKeyboardMarkup(text = "Средняя", callback_data = "dry_medium")
bot_item_btn_low_dry = types.InlineKeyboardMarkup(text = "Минимальная", callback_data = "dry_low")
markup_inline_dry.add(bot_item_btn_high_dry)
markup_inline_dry.add(bot_item_btn_medium_dry)
markup_inline_dry.add(bot_item_btn_low_dry)
client.send_message(call.message.chat.id, "Осмысленность?", reply_markup = markup_inline_dry)
if call.data == "creativity_low":
params["topP"] = 0.5
markup_inline_dry = types.InlineKeyboardMarkup()
bot_item_btn_high_dry = types.InlineKeyboardMarkup(text = "Максимальная", callback_data = "dry_high")
bot_item_btn_medium_dry = types.InlineKeyboardMarkup(text = "Средняя", callback_data = "dry_medium")
bot_item_btn_low_dry = types.InlineKeyboardMarkup(text = "Минимальная", callback_data = "dry_low")
markup_inline_dry.add(bot_item_btn_high_dry)
markup_inline_dry.add(bot_item_btn_medium_dry)
markup_inline_dry.add(bot_item_btn_low_dry)
client.send_message(call.message.chat.id, "Осмысленность?", reply_markup = markup_inline_dry)
@client.message_handler(content_types = ['text'])
def get_text(message):
if "**" in str(message.text):
message_text = str(message.text)
title = message_text.replace("**","")
params["prompt"]["text"] = title
markup_inline_creativity = types.InlineKeyboardMarkup()
bot_item_btn_high_creativity = types.InlineKeyboardButton(text = "Максимальное", callback_data = "creativity_high")
bot_item_btn_medium_creativity = types.InlineKeyboardButton(text = "Среднее", callback_data = "creativity_medium")
bot_item_btn_low_creativity = types.InlineKeyboardButton(text = "Минимальное", callback_data = "creativity_low")
markup_inline_creativity.add(bot_item_btn_high_creativity)
markup_inline_creativity.add(bot_item_btn_medium_creativity)
markup_inline_creativity.add(bot_item_btn_low_creativity)
client.send_message(message.chat.id, "Разнообразие текста?", reply_markup = markup_inline_creativity)
client.polling(none_stop = True, interval = 0)