tuxbot-bot/tuxbot/__main__.py

29 lines
650 B
Python
Raw Normal View History

2021-02-11 22:18:12 +00:00
import sys
2020-09-01 22:08:06 +00:00
from tuxbot import ExitCodes
from tuxbot.core.utils.console import console
2020-06-03 17:41:30 +00:00
2020-10-21 22:00:48 +00:00
def main() -> None:
2020-06-03 17:41:30 +00:00
try:
from .__run__ import run # pylint: disable=import-outside-toplevel
2020-06-03 17:41:30 +00:00
2020-09-01 22:08:06 +00:00
run()
2020-06-03 17:41:30 +00:00
except SystemExit as exc:
2020-09-01 22:08:06 +00:00
if exc.code == ExitCodes.RESTART:
2021-02-11 22:18:12 +00:00
sys.exit(exc.code)
2020-09-01 22:08:06 +00:00
else:
raise exc
except Exception:
console.print_exception(
show_locals=True, word_wrap=True, extra_lines=5
)
2020-06-03 17:41:30 +00:00
if __name__ == "__main__":
2020-08-27 23:06:57 +00:00
try:
main()
except Exception:
console.print_exception(
show_locals=True, word_wrap=True, extra_lines=5
)