2025-04-30 17:07:16 +03:00

45 lines
1.4 KiB
Python

from ai_bot.keyboards.MainKeyboard import MainKeyboard
from ai_bot.keyboards.MenuKeyboard import MenuKeyboard
from ai_bot.msg.MainMsg import MainMsg
from bot.Handler import Handler
from telegram.constants import ParseMode
from bot import FIRST
from igf_api.IgfClient import IgfClient
from piapi_ai import client
class MainHandler(Handler):
@staticmethod
async def start(update, context):
msg = MainMsg()
reply_markup = MainKeyboard()
client_igf = IgfClient()
client_igf.tgBot.create({
'bot_id': context.bot.id,
'dialog_id': update.effective_chat.id,
'username': update.effective_chat.username,
'first_name': update.effective_chat.first_name,
'last_name': update.effective_chat.last_name,
'status': 1,
})
client_igf.piapiTask.to_archive_all_new(context.bot.id, update.effective_chat.id)
await context.bot.send_message(chat_id=update.effective_chat.id, text=msg.get_msg(),
parse_mode=ParseMode.HTML, reply_markup=reply_markup.create_keyboard())
return FIRST
@staticmethod
async def get_menu(update, context):
reply_markup = MenuKeyboard()
await context.bot.send_message(chat_id=update.effective_chat.id, text="Меню:",
parse_mode=ParseMode.HTML, reply_markup=reply_markup.create_keyboard())
return FIRST