-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (32 loc) · 829 Bytes
/
main.py
File metadata and controls
41 lines (32 loc) · 829 Bytes
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
"""
Main entry point for UtilsBot+
"""
import asyncio
import sys
from pathlib import Path
# Add project root to Python path
sys.path.insert(0, str(Path(__file__).parent))
from core.bot import UtilsBotPlus
from core.logger import setup_logging
from config.settings import settings
async def main():
"""Main bot entry point"""
# Setup logging
setup_logging()
# Create and run bot
bot = UtilsBotPlus()
try:
await bot.start(settings.bot_token)
except KeyboardInterrupt:
await bot.close()
except Exception as e:
await bot.close()
raise e
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
print("\nBot stopped by user")
except Exception as e:
print(f"Fatal error: {e}")
sys.exit(1)