ui:
:
This commit is contained in:
@ -36,19 +36,15 @@ class States(StatesGroup):
|
|||||||
|
|
||||||
@bot.message_handler(commands=["start"])
|
@bot.message_handler(commands=["start"])
|
||||||
async def start(msg: Message):
|
async def start(msg: Message):
|
||||||
|
if msg.chat.type == "private":
|
||||||
user = session.query(User).filter_by(id=msg.from_user.id).first()
|
user = session.query(User).filter_by(id=msg.from_user.id).first()
|
||||||
if user:
|
if not user:
|
||||||
await bot.send_message(chat_id=msg.chat.id, text="Вы зарегистрированы!")
|
|
||||||
else:
|
|
||||||
await bot.send_message(chat_id=msg.chat.id, text="Привет, новый пользователь, регистрирую тебя..")
|
|
||||||
new_user = User(id=msg.from_user.id, name=msg.from_user.first_name, username=msg.from_user.username)
|
new_user = User(id=msg.from_user.id, name=msg.from_user.first_name, username=msg.from_user.username)
|
||||||
session.add(new_user)
|
session.add(new_user)
|
||||||
session.commit()
|
session.commit()
|
||||||
await bot.send_message(chat_id=msg.chat.id, text="Регистрация прошла успешно, добро пожаловать!")
|
await bot.send_message(chat_id=msg.chat.id, text=textbook.start)
|
||||||
# if msg.chat.type in ("group", "supergroup"):
|
await bot.set_state(user_id=msg.from_user.id, state=States.default)
|
||||||
# await bot.send_message(chat_id=msg.chat.id, text=textbook.start_group)
|
await bot.send_message(chat_id=msg.chat.id, text=textbook.menu, reply_markup=keyboards.menu())
|
||||||
# else:
|
|
||||||
# await bot.send_message(chat_id=msg.chat.id, text=textbook.start)
|
|
||||||
|
|
||||||
@bot.message_handler(commands=["new_queue"])
|
@bot.message_handler(commands=["new_queue"])
|
||||||
async def nq(msg: Message):
|
async def nq(msg: Message):
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
from telebot.types import InlineKeyboardButton as button, InlineKeyboardMarkup as keyboard
|
||||||
|
|
||||||
|
def menu():
|
||||||
|
return keyboard(
|
||||||
|
keyboard=[
|
||||||
|
[
|
||||||
|
button(text="➕ Новая очередь", callback_data="new")
|
||||||
|
],
|
||||||
|
[
|
||||||
|
button(text="📋 Мои очереди", callback_data="my")
|
||||||
|
],
|
||||||
|
[
|
||||||
|
button(text="ℹ️ О боте", callback_data="about")
|
||||||
|
],
|
||||||
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user