From 47487afb568a3509a210b0d62182e69aa013c608 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 15 Apr 2018 13:50:51 +0200 Subject: [PATCH] Immagino di aver fixato il bot veramente --- discordbot.py | 5 ++++- telegrambot.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/discordbot.py b/discordbot.py index e0351d1f..739e4373 100644 --- a/discordbot.py +++ b/discordbot.py @@ -98,12 +98,14 @@ class Video: if __debug__: version = "Dev" + commit_msg = "_in sviluppo_" else: # Find the latest git tag old_wd = os.getcwd() try: os.chdir(os.path.dirname(__file__)) version = str(subprocess.check_output(["git", "describe", "--tags"]), encoding="utf8").strip() + commit_msg = str(subprocess.check_output(["git", "log", "-1", "--pretty=%B"]), encoding="utf8").strip() except Exception: version = "❓" finally: @@ -155,7 +157,8 @@ async def on_error(event, *args, **kwargs): @client.event async def on_ready(): await client.send_message(client.get_channel(config["Discord"]["main_channel"]), - f"ℹ Royal Bot {version} avviato e pronto a ricevere comandi!") + f"ℹ Royal Bot avviato e pronto a ricevere comandi!\n" + f"Ultimo aggiornamento: `{version}: {commit_msg}`") await client.change_presence(game=None, status=discord.Status.online) diff --git a/telegrambot.py b/telegrambot.py index 4587b567..c2e08433 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -22,12 +22,14 @@ discord_connection = None # Find the latest git tag if __debug__: version = "Dev" + commit_msg = "_in sviluppo_" else: # Find the latest git tag old_wd = os.getcwd() try: os.chdir(os.path.dirname(__file__)) version = str(subprocess.check_output(["git", "describe", "--tags"]), encoding="utf8").strip() + commit_msg = str(subprocess.check_output(["git", "log", "-1", "--pretty=%B"]), encoding="utf8").strip() except Exception: version = "❓" finally: @@ -376,7 +378,9 @@ def process(arg_discord_connection): u.dispatcher.add_handler(CommandHandler("vote", cmd_vote)) u.dispatcher.add_handler(CommandHandler("ban", cmd_ban)) u.dispatcher.add_handler(CallbackQueryHandler(on_callback_query)) - u.bot.send_message(config["Telegram"]["main_group"], f"ℹ Royal Bot {version} avviato e pronto a ricevere comandi!") + u.bot.send_message(config["Telegram"]["main_group"], + f"ℹ Royal Bot avviato e pronto a ricevere comandi!\n" + f"Ultimo aggiornamento: `{version}: {commit_msg}`") while True: try: u.start_polling()