Update elitebot.py
This commit is contained in:
parent
04816f0664
commit
64fdbf7302
1 changed files with 38 additions and 37 deletions
75
elitebot.py
75
elitebot.py
|
@ -1,37 +1,38 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import asyncio # Added this import
|
||||||
from src.bot import Bot
|
|
||||||
|
from src.bot import Bot
|
||||||
|
|
||||||
def main():
|
|
||||||
if len(sys.argv) < 2:
|
def main():
|
||||||
print('Usage: python elitebot.py <config_file>')
|
if len(sys.argv) < 2:
|
||||||
sys.exit(1)
|
print('Usage: python elitebot.py <config_file>')
|
||||||
|
sys.exit(1)
|
||||||
config_file = sys.argv[1]
|
|
||||||
try:
|
config_file = sys.argv[1]
|
||||||
bot = Bot(config_file)
|
try:
|
||||||
except FileNotFoundError as e:
|
bot = Bot(config_file)
|
||||||
print(f'Config file not found: {e}')
|
except FileNotFoundError as e:
|
||||||
sys.exit(1)
|
print(f'Config file not found: {e}')
|
||||||
except Exception as e:
|
sys.exit(1)
|
||||||
print(f'Error loading bot: {e}')
|
except Exception as e:
|
||||||
sys.exit(1)
|
print(f'Error loading bot: {e}')
|
||||||
|
sys.exit(1)
|
||||||
try:
|
|
||||||
print('EliteBot started successfully!')
|
try:
|
||||||
bot.start()
|
print('EliteBot started successfully!')
|
||||||
except Exception as e:
|
asyncio.run(bot.start()) # Corrected here
|
||||||
print(f'Error starting EliteBot: {e}')
|
except Exception as e:
|
||||||
sys.exit(1)
|
print(f'Error starting EliteBot: {e}')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
try:
|
if __name__ == '__main__':
|
||||||
main()
|
try:
|
||||||
except KeyboardInterrupt:
|
main()
|
||||||
print('\nEliteBot has been stopped.')
|
except KeyboardInterrupt:
|
||||||
except Exception as e:
|
print('\nEliteBot has been stopped.')
|
||||||
print(f'An unexpected error occurred: {e}')
|
except Exception as e:
|
||||||
|
print(f'An unexpected error occurred: {e}')
|
Loading…
Add table
Reference in a new issue