Skip to content

Commit a83c938

Browse files
committed
Fix langs
1 parent 9e4a993 commit a83c938

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

bot_handlers.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from database import User
33
from state_handler import get_state_and_process, get_state_and_process_callback_query
44
from distance import get_closest_school
5+
from languages import DICTIONARY
56

67

78
@bot.callback_query_handler(func=lambda call: True)
@@ -65,15 +66,14 @@ def handle_location(message):
6566
schools = get_closest_school(message.location.latitude, message.location.longitude)
6667
if schools == []:
6768
bot.send_message(message.chat.id,
68-
'Шкіл поблизу немає. Ви що, в лісі?')
69+
DICTIONARY['ua']['no_schools_nearby_msg'])
6970
else:
7071
for school in schools:
71-
print(school)
7272
bot.send_location(message.chat.id,
7373
school['position']['lat'],
7474
school['position']['lon'])
7575
bot.send_message(message.chat.id,
76-
'{0}\nЗа адресою: {1}'.format(
76+
DICTIONARY['ua']['school_nearby_msg'].format(
7777
school['poi']['name'],
7878
school['address']['freeformAddress']
7979
))

database.py

+5
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ class User(Document):
1717
role = StringField(choices=ROLES, default=ROLES[0])
1818
with_child_in_school = BooleanField(default=False)
1919
language = StringField(choices=LANGUAGES, default=LANGUAGES[0])
20+
21+
22+
class Question(Document):
23+
text = StringField(required=True)
24+
rating = IntField(default=0)

languages.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106

107107
'back_button': '⬅️ Назад',
108108
'no_button': 'Скористайтесь, будь-ласка, клавіатурою',
109-
109+
# other
110+
'no_schools_nearby_msg': 'Шкіл поблизу немає. Ви що, в лісі?',
111+
'school_nearby_msg': '{0}\nЗа адресою: {1}'
110112
},
111113
}

states.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from bot_object import bot
22
from languages import DICTIONARY
33
from keyboards import *
4-
from database import ROLES
4+
from database import Question, ROLES
55
from time import sleep
66

77

0 commit comments

Comments
 (0)