From ed2361638a1f47a7867e66d0bbd0b1b301bd8f54 Mon Sep 17 00:00:00 2001 From: profitroll Date: Tue, 7 Feb 2023 11:35:47 +0100 Subject: [PATCH] This commit closes #27 --- modules/commands/nearby.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/commands/nearby.py b/modules/commands/nearby.py index 993322b..b214f3a 100644 --- a/modules/commands/nearby.py +++ b/modules/commands/nearby.py @@ -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")