This repository has been archived on 2024-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
2022-12-01 05:54:32 -05:00
|
|
|
from load import dp, types
|
|
|
|
from database import Member
|
|
|
|
|
|
|
|
@dp.message_handler(content_types=["new_chat_members"])
|
|
|
|
async def welcome_message(message:types.Message):
|
|
|
|
user = Member.get_or_none(Member.user_id == message.from_user.id)
|
|
|
|
|
|
|
|
|
|
|
|
if (user):
|
2022-12-25 09:17:05 -05:00
|
|
|
await message.answer(f"Hi, {user.first_name} again")
|
2022-12-01 05:54:32 -05:00
|
|
|
|
|
|
|
if not (user):
|
|
|
|
Member.create(
|
|
|
|
user_id = message.from_user.id,
|
|
|
|
first_name = message.from_user.first_name,
|
|
|
|
username = message.from_user.username,
|
|
|
|
)
|
|
|
|
|
|
|
|
await message.answer((
|
2022-12-25 09:17:05 -05:00
|
|
|
f"Hi, **{user.first_name}**!\n"
|
|
|
|
"Please, read [chat rules]({})"
|
|
|
|
).format(
|
|
|
|
"https://nometa.xyz"
|
|
|
|
),parse_mode="Markdown")
|
2022-12-01 05:54:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
await message.delete()
|