Skip to content

Commit

Permalink
Added MOTD system
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Aug 13, 2020
1 parent c6d7064 commit 2c9a4c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CB/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>'
__docformat__ = 'restructuredtext en'
Expand Down
8 changes: 8 additions & 0 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2c9a4c5

Please sign in to comment.