2022-12-05 19:49:51 +02:00
|
|
|
from app import app
|
|
|
|
from pyrogram import filters
|
2022-12-27 14:36:54 +02:00
|
|
|
from pyrogram.types import ReplyKeyboardMarkup, Message
|
|
|
|
from pyrogram.client import Client
|
2022-12-11 20:52:14 +02:00
|
|
|
from modules.utils import locale, logWrite
|
|
|
|
from modules.database import col_users
|
2022-12-05 19:49:51 +02:00
|
|
|
|
|
|
|
# Start command ================================================================================================================
|
|
|
|
@app.on_message(~ filters.scheduled & filters.private & filters.command(["start"], prefixes=["/"]))
|
2022-12-27 14:36:54 +02:00
|
|
|
async def cmd_start(app: Client, msg: Message):
|
2022-12-05 19:49:51 +02:00
|
|
|
|
2022-12-11 20:52:14 +02:00
|
|
|
user = col_users.find_one({"user": msg.from_user.id})
|
2022-12-05 19:49:51 +02:00
|
|
|
|
2022-12-11 20:52:14 +02:00
|
|
|
if user is None:
|
|
|
|
|
|
|
|
col_users.insert_one({
|
|
|
|
"user": msg.from_user.id,
|
|
|
|
"link": None,
|
|
|
|
"label": "",
|
|
|
|
"tg_name": msg.from_user.first_name,
|
|
|
|
"tg_phone": msg.from_user.phone_number,
|
|
|
|
"tg_locale": msg.from_user.language_code,
|
|
|
|
"tg_username": msg.from_user.username
|
|
|
|
})
|
|
|
|
|
|
|
|
logWrite(f"User {msg.from_user.id} started bot interaction")
|
2022-12-17 01:58:33 +02:00
|
|
|
await msg.reply_text(locale("start", "message", locale=msg.from_user), reply_markup=ReplyKeyboardMarkup(locale("welcome", "keyboard", locale=msg.from_user), resize_keyboard=True))
|
2022-12-05 19:49:51 +02:00
|
|
|
# ==============================================================================================================================
|