Queer European MD passionate about IT
Browse Source

Pass all information to command handler when using /start

Davte 4 years ago
parent
commit
68974c4c40
2 changed files with 10 additions and 5 deletions
  1. 1 1
      davtelepot/__init__.py
  2. 9 4
      davtelepot/helper.py

+ 1 - 1
davtelepot/__init__.py

@@ -11,7 +11,7 @@ __author__ = "Davide Testa"
 __email__ = "davide@davte.it"
 __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
 __license__ = "GNU General Public License v3.0"
-__version__ = "2.6.16"
+__version__ = "2.6.17"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 

+ 9 - 4
davtelepot/helper.py

@@ -1,6 +1,8 @@
 """Make a self-consistent bot help section."""
 
 # Project modules
+from collections import OrderedDict
+
 from .bot import Bot
 from .messages import default_help_messages
 from .utilities import (
@@ -234,14 +236,16 @@ async def _help_button(bot, update, user_record, data):
     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'])
     if not text:
         return await _help_command(bot, update, user_record)
     update['text'] = text
     await bot.text_message_handler(
         update=update,
-        user_record=None
+        user_record=user_record,
+        language=language
     )
     return
 
@@ -258,8 +262,9 @@ def init(telegram_bot: Bot, help_messages: dict = None):
     telegram_bot.messages['help'] = help_messages
 
     @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'],
                           reply_keyboard_button=help_messages['help_command'][