understanding commited on
Commit
0aafa6a
·
verified ·
1 Parent(s): 3f7521a

Create bot/server/main.py

Browse files
Files changed (1) hide show
  1. bot/server/main.py +18 -0
bot/server/main.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from quart import Blueprint, jsonify
2
+ from bot.startup_log import uptime_s
3
+ from bot import TelegramBot
4
+
5
+ bp = Blueprint("main", __name__)
6
+
7
+ @bp.route("/")
8
+ async def home():
9
+ return "OK: talking bot + web server", 200
10
+
11
+ @bp.route("/health")
12
+ async def health():
13
+ # simple health + uptime + connected state
14
+ return jsonify({
15
+ "ok": True,
16
+ "uptime_s": uptime_s(),
17
+ "connected": bool(getattr(TelegramBot, "is_connected", False))
18
+ }), 200