|
@@ -1,6 +1,8 @@
|
|
"""Make a self-consistent bot help section."""
|
|
"""Make a self-consistent bot help section."""
|
|
|
|
|
|
# Project modules
|
|
# Project modules
|
|
|
|
+from collections import OrderedDict
|
|
|
|
+
|
|
from .bot import Bot
|
|
from .bot import Bot
|
|
from .messages import default_help_messages
|
|
from .messages import default_help_messages
|
|
from .utilities import (
|
|
from .utilities import (
|
|
@@ -234,14 +236,16 @@ async def _help_button(bot, update, user_record, data):
|
|
return result
|
|
return result
|
|
|
|
|
|
|
|
|
|
-async def _start_command(bot, update, user_record):
|
|
|
|
|
|
+async def _start_command(bot: Bot, update: dict,
|
|
|
|
+ user_record: OrderedDict, language: str):
|
|
text = get_cleaned_text(update=update, bot=bot, replace=['start'])
|
|
text = get_cleaned_text(update=update, bot=bot, replace=['start'])
|
|
if not text:
|
|
if not text:
|
|
return await _help_command(bot, update, user_record)
|
|
return await _help_command(bot, update, user_record)
|
|
update['text'] = text
|
|
update['text'] = text
|
|
await bot.text_message_handler(
|
|
await bot.text_message_handler(
|
|
update=update,
|
|
update=update,
|
|
- user_record=None
|
|
|
|
|
|
+ user_record=user_record,
|
|
|
|
+ language=language
|
|
)
|
|
)
|
|
return
|
|
return
|
|
|
|
|
|
@@ -258,8 +262,9 @@ def init(telegram_bot: Bot, help_messages: dict = None):
|
|
telegram_bot.messages['help'] = help_messages
|
|
telegram_bot.messages['help'] = help_messages
|
|
|
|
|
|
@telegram_bot.command("/start", authorization_level='everybody')
|
|
@telegram_bot.command("/start", authorization_level='everybody')
|
|
- async def start_command(bot, update, user_record):
|
|
|
|
- return await _start_command(bot, update, user_record)
|
|
|
|
|
|
+ async def start_command(bot, update, user_record, language):
|
|
|
|
+ return await _start_command(bot=bot, update=update,
|
|
|
|
+ user_record=user_record, language=language)
|
|
|
|
|
|
@telegram_bot.command(command='/help', aliases=['00help'],
|
|
@telegram_bot.command(command='/help', aliases=['00help'],
|
|
reply_keyboard_button=help_messages['help_command'][
|
|
reply_keyboard_button=help_messages['help_command'][
|