forked from EliteBot-irc/EliteBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elitebot.py
41 lines (32 loc) · 894 Bytes
/
elitebot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
import asyncio
import os
import sys
from src.bot import Bot
def main():
os.makedirs('data', exist_ok=True)
if len(sys.argv) < 2:
print('Usage: python elitebot.py <config_file>')
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}')