Changed contact viewing logic
This commit is contained in:
parent
fc0579f2f6
commit
b1ca1fb0be
10
main.py
10
main.py
@ -1,6 +1,6 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from time import time
|
from time import time
|
||||||
from os import getpid, listdir, remove
|
from os import getpid, path
|
||||||
from modules.utils import *
|
from modules.utils import *
|
||||||
|
|
||||||
from pyrogram.client import Client
|
from pyrogram.client import Client
|
||||||
@ -228,9 +228,9 @@ async def callback_query_refuse(app, clb):
|
|||||||
|
|
||||||
|
|
||||||
# Contact getting ==============================================================================================================
|
# Contact getting ==============================================================================================================
|
||||||
@app.on_message(~ filters.scheduled & filters.contact)
|
@app.on_message(~ filters.scheduled & filters.contact & filters.private)
|
||||||
async def get_contact(app, msg):
|
async def get_contact(app, msg):
|
||||||
if (msg.from_user.id in configGet("admins")) or (msg.from_user.id == configGet("owner")):
|
if (path.exists(f"{configGet('data', 'locations')}{sep}users{sep}{msg.from_user.id}.json") and jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{msg.from_user.id}.json")["approved"]) or (msg.from_user.id in configGet("admins")) or (msg.from_user.id == configGet("owner")):
|
||||||
if msg.contact.user_id != None:
|
if msg.contact.user_id != None:
|
||||||
try:
|
try:
|
||||||
user_data = jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{msg.contact.user_id}.json")
|
user_data = jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{msg.contact.user_id}.json")
|
||||||
@ -242,9 +242,9 @@ async def get_contact(app, msg):
|
|||||||
if user_data["sent"]:
|
if user_data["sent"]:
|
||||||
application = jsonLoad(f"{configGet('data', 'locations')}{sep}applications.json")[str(msg.contact.user_id)]
|
application = jsonLoad(f"{configGet('data', 'locations')}{sep}applications.json")[str(msg.contact.user_id)]
|
||||||
if user_data["approved"]:
|
if user_data["approved"]:
|
||||||
application_status = locale("application_status_accepted", "message").format(await app.get_users(application["approved_by"]).first_name, datetime.fromtimestamp(application["approval_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
application_status = locale("application_status_accepted", "message").format((await app.get_users(application["approved_by"])).first_name, datetime.fromtimestamp(application["approval_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
||||||
elif application["refused"]:
|
elif application["refused"]:
|
||||||
application_status = locale("application_status_refused", "message").format(await app.get_users(application["refused_by"]).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
application_status = locale("application_status_refused", "message").format((await app.get_users(application["refused_by"])).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
||||||
else:
|
else:
|
||||||
application_status = locale("application_status_on_hold", "message")
|
application_status = locale("application_status_on_hold", "message")
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user