tuxbot-bot/tuxbot/__main__.py
2020-09-02 00:08:06 +02:00

31 lines
611 B
Python

from typing import NoReturn
from rich.console import Console
from rich.traceback import install
from tuxbot import ExitCodes
console = Console()
install(console=console)
def main() -> NoReturn:
try:
from .__run__ import run
run()
except SystemExit as exc:
if exc.code == ExitCodes.RESTART:
from .__run__ import run # reimport to load changes
run()
else:
raise exc
except Exception:
console.print_exception()
if __name__ == "__main__":
try:
main()
except Exception:
console.print_exception()