Fixed questions source for inline

This commit is contained in:
Profitroll 2022-12-04 11:27:59 +01:00
parent 9105a0266c
commit fd858afcfd

View File

@ -33,19 +33,22 @@ async def inline_answer(client, inline_query):
results = []
applications = jsonLoad(f"{configGet('data', 'locations')}{sep}applications.json")
for match in list_of_users:
try:
user_data = jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{match.user.id}.json")
application_content = []
i = 1
for question in configGet("application", file=str(match.user.id)):
for question in applications[str(match.user.id)]["application"]:
if i == 2:
age = relativedelta(datetime.now(), datetime.strptime(configGet('application', file=str(match.user.id))['2'], '%d.%m.%Y'))
application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {configGet('application', file=str(match.user.id))['2']} ({age.years} р.)")
age = relativedelta(datetime.now(), datetime.strptime(applications[str(match.user.id)]['application']['2'], '%d.%m.%Y'))
application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {applications[str(match.user.id)]['application']['2']} ({age.years} р.)")
else:
application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {configGet('application', file=str(match.user.id))[question]}")
application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {applications[str(match.user.id)]['application'][question]}")
i += 1
except KeyError:
continue
except FileNotFoundError:
continue
except TypeError: