From 1446e12b15b49e2b28eeec83c1b536627cf67935 Mon Sep 17 00:00:00 2001 From: ComputerTech312 Date: Thu, 22 Feb 2024 12:28:35 +0100 Subject: [PATCH] re added elitebot.py --- .gitignore | 1 + elitebot.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 elitebot.py diff --git a/.gitignore b/.gitignore index 1b882a1..788eb51 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ logs test.json elitebot .idea +venv \ No newline at end of file diff --git a/elitebot.py b/elitebot.py new file mode 100644 index 0000000..18fa6b8 --- /dev/null +++ b/elitebot.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +import asyncio +import sys + +from src.bot import Bot + + +def main(): + if len(sys.argv) < 2: + print('Usage: python elitebot.py ') + sys.exit(1) + + config_file = sys.argv[1] + try: + bot = Bot(config_file) + except FileNotFoundError as e: + print(f'Config file not found: {e}') + sys.exit(1) + except Exception as e: + print(f'Error loading bot: {e}') + sys.exit(1) + + try: + print('EliteBot started successfully!') + asyncio.run(bot.start()) + except Exception as e: + print(f'Error starting EliteBot: {e}') + sys.exit(1) + + +if __name__ == '__main__': + try: + main() + except KeyboardInterrupt: + print('\nEliteBot has been stopped.') + except Exception as e: + print(f'An unexpected error occurred: {e}')