From f4fbda228ebaa4048249ccbbff5f3a444ea1549a Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 5 Mar 2019 15:22:45 +0100 Subject: [PATCH 1/5] Add /brawlhalla --- webserver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webserver.py b/webserver.py index 8b5ddda0..af819b2e 100644 --- a/webserver.py +++ b/webserver.py @@ -381,6 +381,11 @@ def page_activity(): hourly_before=hourly_before) +@app.route("/brawlhalla") +def page_brawlhalla(): + return render_template("brawlhalla.html") + + @app.route("/hooks/github", methods=["POST"]) def hooks_github(): try: From c4f8aed38fe04d2e39beb5a472374ec4edd81bb3 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 5 Mar 2019 15:38:02 +0100 Subject: [PATCH 2/5] Add /brawlhalla --- templates/brawlhalla.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 templates/brawlhalla.html diff --git a/templates/brawlhalla.html b/templates/brawlhalla.html new file mode 100644 index 00000000..5b4281f9 --- /dev/null +++ b/templates/brawlhalla.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} + +{% block pagetitle %} + Il monarca del Valhalla +{% endblock %} + +{% block body %} +

+ Il monarca del Valhalla +

+
+ +
+{% endblock %} From 501f090800058d00f9a8bcf9509413ff41417792 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 7 Mar 2019 18:02:17 +0100 Subject: [PATCH 3/5] Remove brawlhalla page, since it doesn't work --- templates/brawlhalla.html | 14 -------------- webserver.py | 5 ----- 2 files changed, 19 deletions(-) delete mode 100644 templates/brawlhalla.html diff --git a/templates/brawlhalla.html b/templates/brawlhalla.html deleted file mode 100644 index 5b4281f9..00000000 --- a/templates/brawlhalla.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends 'base.html' %} - -{% block pagetitle %} - Il monarca del Valhalla -{% endblock %} - -{% block body %} -

- Il monarca del Valhalla -

-
- -
-{% endblock %} diff --git a/webserver.py b/webserver.py index af819b2e..8b5ddda0 100644 --- a/webserver.py +++ b/webserver.py @@ -381,11 +381,6 @@ def page_activity(): hourly_before=hourly_before) -@app.route("/brawlhalla") -def page_brawlhalla(): - return render_template("brawlhalla.html") - - @app.route("/hooks/github", methods=["POST"]) def hooks_github(): try: From 344b844dea52abdae78f937707a37100fb41370c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 7 Mar 2019 18:14:10 +0100 Subject: [PATCH 4/5] Fix brawlhalla rank bug --- statsupdate.py | 10 +++++----- utils/dirty.py | 17 +++++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/statsupdate.py b/statsupdate.py index 548976da..c505eec2 100644 --- a/statsupdate.py +++ b/statsupdate.py @@ -133,17 +133,17 @@ def brawlhalla_rank_change(item, change: typing.Tuple[DirtyDelta, Dirty]): try: if solo.delta >= 10: reply_msg(telegram_bot, main_chat_id, strings.STATSUPDATE.BRAWLHALLA.SOLO, - username=item.steam.royal.username, + username=item.steam.royal.telegram.mention(), rating=solo.value, - delta=solo.delta_string()) + delta=solo.difference_string()) if team.is_dirty(): partner = item.best_team_partner if partner is None: - other = "???" + other = "qualcun altro" else: - other = partner.steam.royal.username + other = partner.steam.royal.telegram.mention() reply_msg(telegram_bot, main_chat_id, strings.STATSUPDATE.BRAWLHALLA.TEAM, - username=item.steam.royal.username, + username=item.steam.royal.telegram.mention(), rating=team.value[1], other=other) except Exception: diff --git a/utils/dirty.py b/utils/dirty.py index b709b6e0..42123db1 100644 --- a/utils/dirty.py +++ b/utils/dirty.py @@ -14,8 +14,9 @@ class Dirty: class DirtyDelta(Dirty): + @property - def delta(self): + def difference(self): if self.initial_value is None: initial_value = 0 else: @@ -24,9 +25,13 @@ class DirtyDelta(Dirty): value = 0 else: value = self.value - return abs(value - initial_value) + return value - initial_value - def delta_string(self): - if self.delta > 0: - return f"+{self.delta}" - return self.delta + @property + def delta(self): + return abs(self.difference) + + def difference_string(self): + if self.difference > 0: + return f"+{self.difference}" + return self.difference From 6c6a415bab7ed70b922ebb9dff966063c52bda94 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 8 Mar 2019 12:53:30 +0100 Subject: [PATCH 5/5] Add some emojis to emojify --- utils/emojify.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/emojify.py b/utils/emojify.py index 0fe5543e..b25fd194 100644 --- a/utils/emojify.py +++ b/utils/emojify.py @@ -26,8 +26,10 @@ emojis = { "a": ["๐Ÿ…ฐ๏ธ"], "b": ["๐Ÿ…ฑ๏ธ"], "c": ["โ˜ช๏ธ", "ยฉ", "๐Ÿฅ"], + "d": ["๐Ÿ‡ฉ"], "e": ["๐Ÿ“ง", "๐Ÿ’ถ"], "f": ["๐ŸŽ"], + "g": ["๐Ÿ‡ฌ"], "h": ["๐Ÿจ", "๐Ÿฉ", "๐Ÿ‹โ€โ™€", "๐Ÿ‹โ€โ™‚"], "i": ["โ„น๏ธ", "โ™Š๏ธ", "๐Ÿ••"], "j": ["โคด๏ธ"], @@ -44,8 +46,8 @@ emojis = { "u": ["โ›Ž", "โš“๏ธ", "๐Ÿ‰", "๐ŸŒ™", "๐Ÿ‹"], "v": ["โœ…", "๐Ÿ”ฝ", "โ˜‘๏ธ", "โœ”๏ธ"], "w": ["๐Ÿคทโ€โ™€","๐Ÿคทโ€โ™‚", "๐Ÿคพโ€โ™€", "๐Ÿคพโ€โ™‚", "๐Ÿคฝโ€โ™€", "๐Ÿคฝโ€โ™‚"], - "y": ["๐Ÿ’ด"], "x": ["๐Ÿ™…โ€โ™€", "๐Ÿ™…โ€โ™‚", "โŒ", "โŽ"], + "y": ["๐Ÿ’ด"], "z": ["โšก๏ธ"] }