Queer European MD passionate about IT
Browse Source

Show all packages with /version command

Davte 4 years ago
parent
commit
baf1dbbe62
3 changed files with 17 additions and 12 deletions
  1. 1 1
      davtelepot/__init__.py
  2. 9 4
      davtelepot/administration_tools.py
  3. 7 7
      davtelepot/messages.py

+ 1 - 1
davtelepot/__init__.py

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

+ 9 - 4
davtelepot/administration_tools.py

@@ -796,14 +796,19 @@ async def get_last_commit():
     return last_commit
 
 
-async def _version_command(bot, update, user_record):
+async def _version_command(bot: davtelepot_bot, update, user_record):
     last_commit = await get_last_commit()
-    return bot.get_message(
-        'admin', 'version_command', 'result',
+    text = bot.get_message(
+        'admin', 'version_command', 'header',
         last_commit=last_commit,
-        davtelepot_version=__version__,
         update=update, user_record=user_record
     )
+    text += '\n'.join(
+        f"<b>{package.__name__}</b>: "
+        f"<code>{package.__version__}</code>"
+        for package in bot.packages
+    )
+    return text
 
 
 async def notify_new_version(bot: davtelepot_bot):

+ 7 - 7
davtelepot/messages.py

@@ -262,15 +262,15 @@ default_admin_messages = {
             'it': "Versione #️⃣",
         },
         'description': {
-            'en': "Get source code version",
-            'it': "Chiedi la versione del codice sorgente",
+            'en': "Get packages version and source code last commit",
+            'it': "Chiedi la versione dei pacchetti e del codice sorgente",
         },
         'help_section': None,
-        'result': {
-            'en': "Last commit: <code>{last_commit}</code>\n\n"
-                  "davtelepot version: <code>{davtelepot_version}</code>",
-            'it': "Ultimo commit: <code>{last_commit}</code>\n\n"
-                  "Versione di davtelepot: <code>{davtelepot_version}</code>",
+        'header': {
+            'en': "ℹ️ Version information #️⃣\n\n"
+                  "Last commit: <code>{last_commit}</code>",
+            'it': "ℹ️ Informazioni sulle versioni dei pacchetti #️⃣\n\n"
+                  "Ultimo commit: <code>{last_commit}</code>"
         },
     },
 }