first
This commit is contained in:
44
ai_bot/handlers/MainHandler.py
Normal file
44
ai_bot/handlers/MainHandler.py
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
Reference in New Issue
Block a user