mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-06-28 05:26:07 +00:00
Refactor device management: add vendor field, enhance admin display, and improve MAC address handling
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m18s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m18s
This commit is contained in:
@ -59,9 +59,13 @@ def send_sms(mobile: str, message: str):
|
||||
return False
|
||||
|
||||
|
||||
# def escape_markdown_v2(text: str) -> str:
|
||||
# special_chars = r"\_*[]()~`>#+-=|{}.!"
|
||||
# return "".join(["\\" + c if c in special_chars else c for c in text])
|
||||
def escape_markdown_v2(text: str) -> str:
|
||||
special_chars = r"\~`>#+-=|{}!"
|
||||
return "".join(["\\" + c if c in special_chars else c for c in text])
|
||||
|
||||
|
||||
def normalize_whitespace(text: str) -> str:
|
||||
return "\n".join(line.strip() for line in text.strip().splitlines())
|
||||
|
||||
|
||||
def send_telegram_markdown(message: str):
|
||||
@ -83,3 +87,9 @@ def send_telegram_markdown(message: str):
|
||||
except requests.RequestException as e:
|
||||
logger.error(f"Error sending Telegram message: {e}")
|
||||
return {"error": str(e)}
|
||||
|
||||
|
||||
def send_clean_telegram_markdown(message: str):
|
||||
text = normalize_whitespace(message)
|
||||
escaped = escape_markdown_v2(text)
|
||||
return send_telegram_markdown(escaped)
|
||||
|
Reference in New Issue
Block a user