mirror of
https://github.com/yshtcn/ServerChanPush2TelegramBot.git
synced 2025-12-11 16:50:22 +08:00
- 修改回html
This commit is contained in:
parent
5b31b3a6b1
commit
a48f0c8ff9
@ -131,7 +131,7 @@ def send_telegram_message(bot_id, chat_id, title, desp=None, url=None):
|
||||
text = text.replace(affected_url, corrected_url)
|
||||
|
||||
if url: # 如果有 url,添加到 text
|
||||
text += f"\n\n[详情]({url})"
|
||||
text += f"\n\n<a href=\"{url}\">详情:</a>"
|
||||
text += f"{url}" # 直接添加 URL,Telegram 会自动处理预览
|
||||
|
||||
text=unescape_url(text)
|
||||
@ -140,17 +140,17 @@ def send_telegram_message(bot_id, chat_id, title, desp=None, url=None):
|
||||
payload = {
|
||||
'chat_id': chat_id,
|
||||
'text': text,
|
||||
'parse_mode': 'markdown',
|
||||
'parse_mode': 'HTML',
|
||||
'disable_web_page_preview': False # 启用网页预览
|
||||
}
|
||||
try:
|
||||
response = requests.post(api_url, data=payload, proxies=proxies, timeout=2)
|
||||
logging.info(f"response: {response.text}")
|
||||
if response.status_code == 200 and response.json().get("ok"):
|
||||
# 保存发送的请求数据
|
||||
converted_sent_data = convert_str_gbk_to_utf8(str(payload))
|
||||
save_sent_data(api_url,converted_sent_data)
|
||||
return True, response.json()
|
||||
|
||||
else:
|
||||
return False, response.json()
|
||||
except requests.RequestException as e:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user