more refinements for the deployment
All checks were successful
Build container / Build (pull_request) Successful in 1m10s

This commit is contained in:
2025-07-29 15:58:34 +02:00
parent 29d951427d
commit f7478fb1e3
15 changed files with 180 additions and 99 deletions

View File

@@ -7,10 +7,14 @@ from telegram.constants import ParseMode
import os
FIRST = 1
import models
from .basehandler import BaseHandler
class StatusHandler(BaseHandler):
"""Shows a short status of the program."""
def __init__(self, entry_string):
self.start_time = datetime.datetime.now()
self.entry_string = entry_string
@@ -35,7 +39,6 @@ class StatusHandler(BaseHandler):
reply_markup = InlineKeyboardMarkup(keyboard)
delta = str(datetime.datetime.now() - self.start_time)
message = "BeebBop, this is Norbit\n"
try:
ip = httpx.get('https://api.ipify.org').text
@@ -47,18 +50,21 @@ class StatusHandler(BaseHandler):
ip = "not fetchable"
local_ips = "not fetchable"
message += "Status: Running 🟢\n"
message += f"Version: `{os.getenv('BOT_VERSION', 'dev')}`\n"
message += f"Uptime: `{delta[:delta.rfind('.')]}`\n"
message += f"IP \(public\): `{ip}`\n"
message += f"IP \(private\): `{local_ips}`\n"
message += f"Chat ID: `{update.effective_chat.id}`\n"
message = f"""
BeebBop\!
Status: Running 🟢
Version: `{os.getenv('BOT_VERSION', 'dev')}` and`prod={models.IS_PRODUCTION}`
Uptime: `{delta[:delta.rfind('.')]}`
IP \(public\): `{ip}`
IP \(private\): `{local_ips}`
Chat ID: `{update.effective_chat.id}`
""".strip() # remove trailing whitespace
if update.message:
await update.message.reply_text(message, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN_V2)
else:
await update._effective_chat.send_message(message, reply_markup=reply_markup, parse_mode=ParseMode.MARKDOWN_V2)
return FIRST