From 2c9a4c5c530ec843ff11e8a6378452b871a7c4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Thu, 13 Aug 2020 11:56:28 +0200 Subject: [PATCH] Added MOTD system --- CB/__init__.py | 2 +- CurseBreaker.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CB/__init__.py b/CB/__init__.py index b22583d..d24d5ab 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -2,7 +2,7 @@ import random from rich.terminal_theme import TerminalTheme -__version__ = '3.9.2' +__version__ = '3.9.3' __license__ = 'GPLv3' __copyright__ = '2019-2020, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en' diff --git a/CurseBreaker.py b/CurseBreaker.py index b05e7fc..60f576f 100644 --- a/CurseBreaker.py +++ b/CurseBreaker.py @@ -18,6 +18,7 @@ from rich.text import Text from rich.rule import Rule from rich.table import Table +from rich.panel import Panel from rich.console import Console from rich.progress import Progress, BarColumn from rich.traceback import Traceback, install @@ -135,6 +136,7 @@ def start(self): if not self.headless: self.print_header() try: + self.motd_parser() self.c_update(None, True) if self.core.backup_check(): self.setup_table() @@ -223,6 +225,12 @@ def auto_update(self): pause(self.headless) sys.exit(1) + def motd_parser(self): + payload = requests.get('https://storage.googleapis.com/cursebreaker/motd', headers=HEADERS) + if payload.status_code == 200: + self.console.print(Panel(payload.content.decode('UTF-8'), title='MOTD', border_style='red')) + self.console.print('') + def handle_exception(self, e, table=True): if self.table.row_count > 1 and table: self.console.print(self.table)