fix: strip inline comments from extracted Telegram env [skip ci]

This commit is contained in:
alisaza 2026-09-13 18:31:29 +03:30
parent ac8bb3bae1
commit 27863718ff

View File

@ -33,6 +33,9 @@ def main() -> None:
value = value.strip() value = value.strip()
if len(value) >= 2 and value[0] == value[-1] and value[0] in "\"'": if len(value) >= 2 and value[0] == value[-1] and value[0] in "\"'":
value = value[1:-1] value = value[1:-1]
# Inline comments in .env (e.g. THREAD_ID=8 # ops)
if ' #' in f' {value}':
value = value.split('#', 1)[0].rstrip()
value = value.replace('\n', '').replace('\r', '') value = value.replace('\n', '').replace('\r', '')
found[key] = value found[key] = value
if 'TELEGRAM_BOT_TOKEN' in found: if 'TELEGRAM_BOT_TOKEN' in found: