This commit closes #27

This commit is contained in:
Profitroll 2023-02-07 11:35:47 +01:00
parent 0c78f21c96
commit ed2361638a
1 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,4 @@
from os import path
from traceback import print_exc
from app import app
from pyrogram import filters
@ -6,7 +7,7 @@ from pyrogram.client import Client
from classes.holo_user import HoloUser
from modules import custom_filters
from modules.logging import logWrite
from modules.utils import configGet, locale, should_quote, find_location
from modules.utils import configGet, jsonLoad, locale, should_quote, find_location
from modules.database import col_applications, col_users
from classes.errors.geo import PlaceNotFoundError
@ -43,10 +44,11 @@ async def cmd_nearby(app: Client, msg: Message):
if not entry["user"] == msg.from_user.id:
user = col_users.find_one( {"user": entry["user"]} )
if user is not None:
if user["tg_username"] not in [None, "None", ""]: # Check if user has any name
output.append(f'• **{user["tg_name"]}** (@{user["tg_username"]}):\n - {entry["application"]["3"]["name"]}, {entry["application"]["3"]["adminName1"]}')
else:
output.append(f'• **{user["tg_name"]}**:\n - {entry["application"]["3"]["name"]}, {entry["application"]["3"]["adminName1"]}')
if entry["user"] in jsonLoad(path.join(configGet("cache", "locations"), "group_members")):
if user["tg_username"] not in [None, "None", ""]: # Check if user has any name
output.append(f'• **{user["tg_name"]}** (@{user["tg_username"]}):\n - {entry["application"]["3"]["name"]}, {entry["application"]["3"]["adminName1"]}')
else:
output.append(f'• **{user["tg_name"]}**:\n - {entry["application"]["3"]["name"]}, {entry["application"]["3"]["adminName1"]}')
logWrite(f"{holo_user.id} tried to find someone nearby {location[1]} {location[0]} in the radius of {configGet('search_radius')} kilometers")