tg_bot/handlers/SetRoleHandler.py

41 lines
1.3 KiB
Python
Raw Normal View History

2024-12-06 14:20:29 +03:00
from bot.Handler import Handler
from db.services.ChatService import ChatService
from bot import SET_EMAIL_STEP
from bot.DaMsg import DaMsg
from bot.msg.SetEmailMsg import SetEmailMsg
class SetRoleHandler(Handler):
@staticmethod
async def set_partner(update, context):
chat = ChatService.get_by_chat_id(update.effective_chat.id)
ChatService.edit(chat, "status", 20)
msg = SetEmailMsg(update.effective_message)
await context.bot.send_message(chat_id=update.effective_chat.id, text=msg.get_msg())
return SET_EMAIL_STEP
@staticmethod
async def set_developer(update, context):
chat = ChatService.get_by_chat_id(update.effective_chat.id)
ChatService.edit(chat, "status", 10)
msg = SetEmailMsg(update.effective_message)
await context.bot.send_message(chat_id=update.effective_chat.id, text=msg.get_msg())
return SET_EMAIL_STEP
@staticmethod
async def set_email(update, context):
chat = ChatService.get_by_chat_id(update.effective_chat.id)
msg = DaMsg(update.effective_message)
ChatService.edit(chat, "email", msg.text)
await context.bot.send_message(chat_id=update.effective_chat.id, text="Спасибо)")
return SET_EMAIL_STEP