mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 22:56:07 +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 = (
|
||||
f"https://api.telegram.org/bot{push_config.get('TG_BOT_TOKEN')}/sendMessage"
|
||||
)
|
||||
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
||||
payload = {
|
||||
headers = {"Content-Type": "application/json"}
|
||||
data = {
|
||||
"chat_id": str(push_config.get("TG_USER_ID")),
|
||||
"text": f"{title}\n\n{content}",
|
||||
"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")
|
||||
)
|
||||
proxies = {"http": proxyStr, "https": proxyStr}
|
||||
response = requests.post(
|
||||
url=url, headers=headers, params=payload, proxies=proxies
|
||||
).json()
|
||||
response = requests.post(url=url, headers=headers, json=data, proxies=proxies).json()
|
||||
|
||||
if response["ok"]:
|
||||
print("tg 推送成功!")
|
||||
|
|
Loading…
Reference in New Issue
Block a user