Conditions | 4 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # -*- coding:utf-8 -*- |
||
14 | async def bot_text_messages_handler(message: msg) -> None: |
||
15 | """ |
||
16 | Handle user's text messages |
||
17 | :param message: |
||
18 | :return: None |
||
19 | """ |
||
20 | |||
21 | user_request = message.text.removeprefix("/") |
||
22 | with Session() as session: |
||
23 | words = WordSelector().by_name(user_request).with_relationships().all(session) |
||
24 | |||
25 | if words: |
||
26 | for word in words: |
||
27 | await bot.send_message( |
||
28 | chat_id=message.chat.id, |
||
29 | text=export_as_str(word), |
||
30 | reply_markup=WordKeyboard(word).keyboard_cpx(), |
||
31 | ) |
||
32 | else: |
||
33 | await send_message_by_key(user_request, message.chat.id) |
||
34 |