From 577c6f07dbbb4e3620a562829f984feb3b8c12a3 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 7 Nov 2018 19:29:31 +0100 Subject: [PATCH 1/5] Update update.sh --- update.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/update.sh b/update.sh index 45c16a83..6b9e25b4 100755 --- a/update.sh +++ b/update.sh @@ -1,5 +1,14 @@ #!/usr/bin/env bash +# Requires SENTRY_AUTH_TOKEN and SENTRY_ORG set in .profile + +old=$(git rev-list HEAD -n 1) git pull +new=$(git rev-list HEAD -n 1) +if [ ${old} = ${new} ]; then + version=$(sentry-cli releases propose-version) + sentry-cli releases new -p royalnet ${version} + sentry-cli releases set-commits --auto ${version} +fi sudo python3.6 -m pip install -r requirements.txt sudo service apache2 restart python3.6 -OO bots.py \ No newline at end of file From 3d163b17369d4ff0317d0955bc8a44e8c21c1afa Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 7 Nov 2018 19:32:38 +0100 Subject: [PATCH 2/5] Escape names in /cv --- discordbot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/discordbot.py b/discordbot.py index b4a0a9d9..260e78c1 100644 --- a/discordbot.py +++ b/discordbot.py @@ -475,6 +475,7 @@ class RoyalDiscordBot(discord.Client): message += f" | 📺 {member.activity.name}" message += "\n" message += "\n" + message = message.replace("<", "<").replace(">", ">") connection.send(message) logger.debug(f"Answered successfully cvlist request.") elif msg.startswith("!"): From b92702548d04017fb597f89c2ef8f185d7b0804d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 7 Nov 2018 19:34:17 +0100 Subject: [PATCH 3/5] Don't crash if bridge is sent without args --- telegrambot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/telegrambot.py b/telegrambot.py index 03db9f88..262fefc9 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -376,6 +376,7 @@ def cmd_bridge(bot: Bot, update: Update): except IndexError: bot.send_message(update.message.chat.id, "⚠ Non hai specificato un comando!\n" "Sintassi corretta: `/bridge `", parse_mode="Markdown") + return discord_connection.send(f"!{data}") result = discord_connection.recv() if result == "error": From bca018520a36557c109b27ce2c0e5af1c9942297 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 7 Nov 2018 19:37:47 +0100 Subject: [PATCH 4/5] Don't crash if ship is sent without args --- telegrambot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegrambot.py b/telegrambot.py index 262fefc9..a492117d 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -332,7 +332,7 @@ def cmd_eat(bot: Bot, update: Update): def cmd_ship(bot: Bot, update: Update): try: _, name_one, name_two = update.message.text.split(" ", 2) - except IndexError: + except ValueError: bot.send_message(update.message.chat.id, "⚠️ Non hai specificato correttamente i due nomi!\n" "Sintassi corretta: `/ship `", parse_mode="Markdown") return From 7fe26e324c565e13eafa6fcc5bfd8bd82e86c04b Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 7 Nov 2018 19:41:49 +0100 Subject: [PATCH 5/5] Announce league rank changes --- statsupdate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/statsupdate.py b/statsupdate.py index b8bd621f..cd0956a9 100644 --- a/statsupdate.py +++ b/statsupdate.py @@ -37,7 +37,7 @@ def update_block(session: db.Session, block: list, delay: float=0, change_callba try: change = item.update(session=session) except Exception as e: - logger.error(f"Error {sys.exc_info()} while updating {repr(item)}.") + logger.warning(f"Error {sys.exc_info()} while updating {repr(item)}.") sentry.extra_context({ "item": repr(item) }) @@ -61,7 +61,11 @@ def new_dota_rank(item: db.Dota): def new_lol_rank(item: db.LeagueOfLegends): try: telegram_bot.send_message(config["Telegram"]["main_group"], - f"✳️ {item.royal.username} è salito di rank su League of Legends!") + f"✳️ {item.royal.username} ha cambiato rank su League of Legends!\n" + f"\n" + f"Solo/Duo: {item.solo_division} {item.solo_rank}\n" + f"Flex: {item.flex_division} {item.flex_rank}\n" + f"3v3: {item.twtr_division} {item.twtr_rank}") except Exception: logger.warning(f"Couldn't notify on Telegram: {item}")