Compare commits

...

3 Commits

Author SHA1 Message Date
e61aa17a72 Improved logging and changed message 2022-12-16 12:04:57 +01:00
ee44987ae8 Added "joined_false_link" key 2022-12-16 11:43:53 +01:00
40483c17c1 Rules message changed 2022-12-16 11:43:43 +01:00
3 changed files with 11 additions and 5 deletions

View File

@ -70,6 +70,7 @@
"message_traceback": "⚠️ **Сталась помилка**\nПомилка повідомлень: `{0}` -> `{1}`\nПомилка: `{2}`\n\nTraceback:\n```\n{3}\n```",
"no_user_application": "Не знайдено користувачів за запитом **{0}**",
"user_invalid": "Надісланий користувач не має завершеної анкети.",
"joined_false_link": "Користувач **{0}** (`{1}`) приєднався до групи не за своїм посиланням",
"question_titles": {
"question1": "Ім'я/звертання:",
"question2": "День народження:",

View File

@ -5,6 +5,7 @@ from pyrogram import filters
from classes.holo_user import HoloUser
from modules.utils import configGet, locale, logWrite
from modules.database import col_tmp, col_applications
from modules.commands.rules import default_rules_markup
# Callbacks application ========================================================================================================
@app.on_callback_query(filters.regex("sub_yes_[\s\S]*"))
@ -27,8 +28,7 @@ async def callback_query_accept(app, clb):
await app.send_message(holo_user.id, locale("read_rules", "message"))
for rule_msg in locale("rules"):
await app.send_message(holo_user.id, rule_msg)
await app.send_message(holo_user.id, locale("rules_msg"), disable_web_page_preview=True, reply_markup=default_rules_markup)
await app.send_message(holo_user.id, locale("approved", "message"), reply_markup=InlineKeyboardMarkup(
[[

View File

@ -1,6 +1,7 @@
from app import app, isAnAdmin
from pyrogram.types import ChatPermissions, InlineKeyboardMarkup, InlineKeyboardButton
from modules.utils import configGet, locale
from modules.logging import logWrite
from classes.holo_user import HoloUser
# Filter users on join =========================================================================================================
@ -12,13 +13,17 @@ async def filter_join(app, member):
holo_user = HoloUser(member.from_user)
if (holo_user.link is not None) and (holo_user.link == member.invite_link):
if (holo_user.link is not None) and (holo_user.link == member.invite_link.invite_link):
logWrite(f"User {holo_user.id} joined destination group with correct link {holo_user.link}")
return
if await isAnAdmin(member.invite_link.creator.id):
logWrite(f"User {holo_user.id} joined destination group with link {holo_user.link} of an admin {member.invite_link.creator.id}")
return
await app.send_message(configGet("admin_group"), f"User **{member.from_user.first_name}** (`{member.from_user.id}`) joined the chat not with his personal link", reply_markup=InlineKeyboardMarkup(
logWrite(f"User {holo_user.id} joined destination group with stolen/unapproved link {holo_user.link}")
await app.send_message(configGet("admin_group"), locale("joined_false_link", "message").format(member.from_user.first_name, member.from_user.id), reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton(text=str(locale("sus_allow", "button")), callback_data=f"sus_allow_{member.from_user.id}")