Data export, warnings' improvements, bug fixes #35

Merged
profitroll merged 30 commits from dev into master 2023-04-02 23:27:31 +03:00
Showing only changes of commit ed2361638a - Show all commits

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")