From 64fdbf7302f49a6cd41eddaba7573530a00a2910 Mon Sep 17 00:00:00 2001 From: Colby Date: Wed, 21 Feb 2024 17:30:47 +0100 Subject: [PATCH] Update elitebot.py --- elitebot.py | 75 +++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/elitebot.py b/elitebot.py index 4f2d53a..45aa7fe 100755 --- a/elitebot.py +++ b/elitebot.py @@ -1,37 +1,38 @@ -#!/usr/bin/env python3 - -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!') - 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}') +#!/usr/bin/env python3 + +import sys +import asyncio # Added this import + +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()) # Corrected here + 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}') \ No newline at end of file