Update main.py
Browse files
main.py
CHANGED
|
@@ -46,8 +46,13 @@ async def lifespan(app: FastAPI):
|
|
| 46 |
app = FastAPI(lifespan=lifespan)
|
| 47 |
|
| 48 |
@app.get("/")
|
| 49 |
-
def health_check():
|
| 50 |
status = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
for i, bot in enumerate(bots):
|
| 52 |
state = "运行中" if bot and bot.poll() is None else "重启中"
|
| 53 |
status.append(f"Bot {i+1}: {state}")
|
|
|
|
| 46 |
app = FastAPI(lifespan=lifespan)
|
| 47 |
|
| 48 |
@app.get("/")
|
| 49 |
+
def health_check(id: int = None):
|
| 50 |
status = []
|
| 51 |
+
if id is not None:
|
| 52 |
+
try:
|
| 53 |
+
return json.load(open(BOT_CONFIGS[id]['id'] + '_paiju.txt', 'r'))
|
| 54 |
+
except Exception as e:
|
| 55 |
+
return {'error': f'{e}'}
|
| 56 |
for i, bot in enumerate(bots):
|
| 57 |
state = "运行中" if bot and bot.poll() is None else "重启中"
|
| 58 |
status.append(f"Bot {i+1}: {state}")
|