Removed legacy
This commit is contained in:
@@ -11,7 +11,7 @@ from dateutil.relativedelta import relativedelta
|
||||
from modules.database import col_applications
|
||||
from modules import custom_filters
|
||||
|
||||
# Applications command =========================================================================================================
|
||||
# Application command ==========================================================================================================
|
||||
@app.on_message(custom_filters.enabled_applications & ~filters.scheduled & filters.command(["application"], prefixes=["/"]) & custom_filters.admin)
|
||||
async def cmd_application(app: Client, msg: Message):
|
||||
|
||||
@@ -55,42 +55,6 @@ async def cmd_application(app: Client, msg: Message):
|
||||
|
||||
logWrite(f"User {msg.from_user.id} requested application of {holo_user.id}")
|
||||
await msg.reply_text(locale("contact", "message", locale=msg.from_user).format(holo_user.id, "\n".join(application_content), application_status), parse_mode=ParseMode.MARKDOWN, quote=should_quote(msg))
|
||||
|
||||
# if (path.exists(f"{configGet('data', 'locations')}{sep}users{sep}{msg.command[1]}.json") and jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{msg.command[1]}.json")["approved"]):
|
||||
# user_id = int(msg.command[1])
|
||||
# else:
|
||||
# list_of_users = []
|
||||
# async for m in app.get_chat_members(configGet("users", "groups"), filter=ChatMembersFilter.SEARCH, query=msg.command[1]):
|
||||
# list_of_users.append(m)
|
||||
# user_id = list_of_users[0].user.id
|
||||
# try:
|
||||
# user_data = jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{user_id}.json")
|
||||
# application = jsonLoad(f"{configGet('data', 'locations')}{sep}applications.json")[str(user_id)]
|
||||
# application_content = []
|
||||
# i = 1
|
||||
# for question in configGet("application", file=str(msg.from_user.id)):
|
||||
# if i == 2:
|
||||
# age = relativedelta(datetime.now(), datetime.strptime(application['application']['2'], '%d.%m.%Y'))
|
||||
# application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {application['application']['2']} ({age.years} р.)")
|
||||
# else:
|
||||
# application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {application['application'][question]}")
|
||||
# i += 1
|
||||
# if user_data["sent"]:
|
||||
# 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"))
|
||||
# elif application["rejected"]:
|
||||
# application_status = locale("application_status_rejected", "message").format((await app.get_users(application["rejected_by"])).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M"))
|
||||
# else:
|
||||
# application_status = locale("application_status_on_hold", "message")
|
||||
# else:
|
||||
# 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"))
|
||||
# elif application["rejected"]:
|
||||
# application_status = locale("application_status_rejected", "message").format((await app.get_users(application["rejected_by"])).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M"))
|
||||
# else:
|
||||
# application_status = locale("application_status_not_send", "message")
|
||||
# logWrite(f"User {msg.from_user.id} requested application of {user_id}")
|
||||
# await msg.reply_text(locale("contact", "message").format(str(user_id), "\n".join(application_content), application_status), quote=should_quote(msg))
|
||||
|
||||
except IndexError:
|
||||
await msg.reply_text(locale("application_invalid_syntax", "message", locale=msg.from_user), quote=should_quote(msg))
|
||||
|
@@ -38,7 +38,6 @@ async def cmd_nearby(app: Client, msg: Message):
|
||||
# Find all users registered in the area provided
|
||||
output = []
|
||||
applications_nearby = col_applications.find( {"application.3.location": { "$nearSphere": {"$geometry": {"type": "Point", "coordinates": [location[0], location[1]]}, "$maxDistance": configGet("search_radius")*1000} } } )
|
||||
# {"application": {"3": {"location": {"$near": { "$geometry": { "type": "Point", "coordinates": location }, "$maxDistance": 30000 }} } } } )
|
||||
|
||||
for entry in applications_nearby:
|
||||
if not entry["user"] == msg.from_user.id:
|
||||
@@ -56,18 +55,4 @@ async def cmd_nearby(app: Client, msg: Message):
|
||||
await msg.reply_text(locale("nearby_result", "message", locale=holo_user).format("\n".join(output)), quote=should_quote(msg))
|
||||
else:
|
||||
await msg.reply_text(locale("nearby_empty", "message", locale=holo_user), quote=should_quote(msg))
|
||||
|
||||
# if not path.exists(f"{configGet('data', 'locations')}{sep}sponsors{sep}{msg.from_user.id}.json"):
|
||||
# jsonSave(jsonLoad(f"{configGet('data', 'locations')}{sep}sponsor_default.json"), f"{configGet('data', 'locations')}{sep}sponsors{sep}{msg.from_user.id}.json")
|
||||
# sponsor = jsonLoad(f"{configGet('data', 'locations')}{sep}sponsors{sep}{msg.from_user.id}.json")
|
||||
# if sponsor["approved"]:
|
||||
# if sponsor["expires"] is not None:
|
||||
# if datetime.strptime(sponsor["expires"], "%d.%m.%Y") > datetime.now():
|
||||
# await msg.reply_text(f"You have an active sub til **{sponsor['expires']}**.")
|
||||
# else:
|
||||
# await msg.reply_text(f"Your sub expired {int((datetime.now()-datetime.strptime(sponsor['expires'], '%d.%m.%Y')).days)} days ago.")
|
||||
# elif sponsor["approved"]:
|
||||
# await msg.reply_text(f"Your sub expiration date is not valid.")
|
||||
# else:
|
||||
# await msg.reply_text(f"You have no active subscription.")
|
||||
# ==============================================================================================================================
|
Reference in New Issue
Block a user