mirror of
https://github.com/anten-ka/gotelegram_pro.git
synced 2026-05-19 13:36:04 +00:00
fix: telemt -v -> --version, CSV header skip in bot stats
This commit is contained in:
@@ -389,7 +389,7 @@ async def check_service_status(service: str) -> bool:
|
||||
|
||||
async def get_telemt_version() -> str:
|
||||
"""Get telemt version."""
|
||||
code, stdout, _ = await sh("telemt", "-v")
|
||||
code, stdout, _ = await sh("telemt", "--version")
|
||||
if code == 0:
|
||||
return stdout.strip().split()[-1] if stdout else "unknown"
|
||||
return "unknown"
|
||||
@@ -699,18 +699,21 @@ async def get_traffic_stats(user_id: Optional[int] = None) -> str:
|
||||
except Exception:
|
||||
return f"📊 <b>{_t(user_id, 'stats_title', 'Statistics')}</b>\n\n<i>{_t(user_id, 'stats_unavailable', 'Data unavailable. Make sure stats module is enabled.')}</i>"
|
||||
|
||||
# Read history
|
||||
# Read history (skip header and non-numeric rows)
|
||||
history = []
|
||||
try:
|
||||
with open(history_file, "r") as f:
|
||||
reader = csv.reader(f)
|
||||
for row in reader:
|
||||
if len(row) >= 3:
|
||||
try:
|
||||
history.append({
|
||||
"ts": int(row[0]),
|
||||
"proxy": int(row[1]),
|
||||
"site": int(row[2]),
|
||||
})
|
||||
except (ValueError, TypeError):
|
||||
continue # skip header or malformed rows
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user