mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-28 07:06:06 +08:00
update:更改tg_bot消息发送方式
This commit is contained in:
parent
2578aae0ba
commit
a2ba64dc50
|
@ -469,8 +469,8 @@ def telegram_bot(title: str, content: str) -> None:
|
||||||
url = (
|
url = (
|
||||||
f"https://api.telegram.org/bot{push_config.get('TG_BOT_TOKEN')}/sendMessage"
|
f"https://api.telegram.org/bot{push_config.get('TG_BOT_TOKEN')}/sendMessage"
|
||||||
)
|
)
|
||||||
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
headers = {"Content-Type": "application/json"}
|
||||||
payload = {
|
data = {
|
||||||
"chat_id": str(push_config.get("TG_USER_ID")),
|
"chat_id": str(push_config.get("TG_USER_ID")),
|
||||||
"text": f"{title}\n\n{content}",
|
"text": f"{title}\n\n{content}",
|
||||||
"disable_web_page_preview": "true",
|
"disable_web_page_preview": "true",
|
||||||
|
@ -489,9 +489,7 @@ def telegram_bot(title: str, content: str) -> None:
|
||||||
push_config.get("TG_PROXY_HOST"), push_config.get("TG_PROXY_PORT")
|
push_config.get("TG_PROXY_HOST"), push_config.get("TG_PROXY_PORT")
|
||||||
)
|
)
|
||||||
proxies = {"http": proxyStr, "https": proxyStr}
|
proxies = {"http": proxyStr, "https": proxyStr}
|
||||||
response = requests.post(
|
response = requests.post(url=url, headers=headers, json=data, proxies=proxies).json()
|
||||||
url=url, headers=headers, params=payload, proxies=proxies
|
|
||||||
).json()
|
|
||||||
|
|
||||||
if response["ok"]:
|
if response["ok"]:
|
||||||
print("tg 推送成功!")
|
print("tg 推送成功!")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user