Finished working on /version command

This commit is contained in:
Davte
2020-05-13 19:44:04 +02:00
parent 217a445a65
commit 2d40903069
2 changed files with 20 additions and 3 deletions

View File

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

View File

@@ -884,10 +884,27 @@ async def _version_command(bot: Bot, update, user_record):
) )
temporary_message = await bot.send_message( temporary_message = await bot.send_message(
text=text + '\n\n⏳ Checking for updates... ☑️', text=text + '\n\n⏳ Checking for updates... ☑️',
update=update update=update,
send_default_keyboard=False
) )
news = await get_new_versions(bot=bot) news = await get_new_versions(bot=bot)
print(news) if not news:
text += '\n\n⌛️ All packages are updated! ✅'
else:
text += '\n\n' + bot.get_message(
'admin', 'updates_available', 'header',
user_record=user_record
) + '\n\n'
text += '\n'.join(
f"<b>{package}</b>: "
f"<code>{versions['current']}</code> —> "
f"<code>{versions['new']}</code>"
for package, versions in news.items()
)
await bot.edit_message_text(
text=text,
update=temporary_message
)
async def notify_new_version(bot: Bot): async def notify_new_version(bot: Bot):