-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
42 lines (33 loc) · 952 Bytes
/
main.py
File metadata and controls
42 lines (33 loc) · 952 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
42
import asyncio
import logging
from logging.handlers import RotatingFileHandler
from logging import Formatter
import os
from app import echo_bot, monitoring_bot, hospital_bot, gpt_bot
os.makedirs("logs", exist_ok=True)
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
filename="logs/bot.log",
encoding="utf-8",
)
async def run_bots():
await echo_bot.start()
await monitoring_bot.start()
await hospital_bot.start()
await gpt_bot.start()
await asyncio.gather(
await echo_bot.run(),
await monitoring_bot.run(),
await hospital_bot.run(),
await gpt_bot.run(),
)
def main():
try:
asyncio.run(run_bots())
except KeyboardInterrupt:
print("\nЗавершение работы всех ботов...")
except Exception as e:
print(f"\nОшибка: {e}")
if __name__ == "__main__":
main()