mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-24 15:43:24 +08:00
修复 Python 和 JavaScript Server酱和企业微信推送的环境变量不一致 (#673)
This commit is contained in:
parent
1437babc6c
commit
482e43dd1f
|
@ -27,23 +27,23 @@ TG_PROXY_IP = '' # tg
|
||||||
TG_PROXY_PORT = '' # tg机器人的TG_PROXY_PORT; secrets可填
|
TG_PROXY_PORT = '' # tg机器人的TG_PROXY_PORT; secrets可填
|
||||||
DD_BOT_TOKEN = '' # 钉钉机器人的DD_BOT_TOKEN; secrets可填
|
DD_BOT_TOKEN = '' # 钉钉机器人的DD_BOT_TOKEN; secrets可填
|
||||||
DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填
|
DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填
|
||||||
QYWX_APP = '' # 企业微信应用的QYWX_APP; secrets可填 参考http://note.youdao.com/s/HMiudGkb
|
QYWX_AM = '' # 企业微信应用的QYWX_AM; secrets可填 参考http://note.youdao.com/s/HMiudGkb
|
||||||
|
|
||||||
notify_mode = []
|
notify_mode = []
|
||||||
|
|
||||||
# GitHub action运行需要填写对应的secrets
|
# GitHub action运行需要填写对应的secrets
|
||||||
if "BARK" in os.environ and os.environ["BARK"]:
|
if "BARK" in os.environ and os.environ["BARK"]:
|
||||||
BARK = os.environ["BARK"]
|
BARK = os.environ["BARK"]
|
||||||
if "SCKEY" in os.environ and os.environ["SCKEY"]:
|
if "PUSH_KEY" in os.environ and os.environ["PUSH_KEY"]:
|
||||||
SCKEY = os.environ["SCKEY"]
|
SCKEY = os.environ["PUSH_KEY"]
|
||||||
if "TG_BOT_TOKEN" in os.environ and os.environ["TG_BOT_TOKEN"] and "TG_USER_ID" in os.environ and os.environ["TG_USER_ID"]:
|
if "TG_BOT_TOKEN" in os.environ and os.environ["TG_BOT_TOKEN"] and "TG_USER_ID" in os.environ and os.environ["TG_USER_ID"]:
|
||||||
TG_BOT_TOKEN = os.environ["TG_BOT_TOKEN"]
|
TG_BOT_TOKEN = os.environ["TG_BOT_TOKEN"]
|
||||||
TG_USER_ID = os.environ["TG_USER_ID"]
|
TG_USER_ID = os.environ["TG_USER_ID"]
|
||||||
if "DD_BOT_TOKEN" in os.environ and os.environ["DD_BOT_TOKEN"] and "DD_BOT_SECRET" in os.environ and os.environ["DD_BOT_SECRET"]:
|
if "DD_BOT_TOKEN" in os.environ and os.environ["DD_BOT_TOKEN"] and "DD_BOT_SECRET" in os.environ and os.environ["DD_BOT_SECRET"]:
|
||||||
DD_BOT_TOKEN = os.environ["DD_BOT_TOKEN"]
|
DD_BOT_TOKEN = os.environ["DD_BOT_TOKEN"]
|
||||||
DD_BOT_SECRET = os.environ["DD_BOT_SECRET"]
|
DD_BOT_SECRET = os.environ["DD_BOT_SECRET"]
|
||||||
if "QYWX_APP" in os.environ and os.environ["QYWX_APP"]:
|
if "QYWX_AM" in os.environ and os.environ["QYWX_AM"]:
|
||||||
QYWX_APP = os.environ["QYWX_APP"]
|
QYWX_AM = os.environ["QYWX_AM"]
|
||||||
|
|
||||||
if BARK:
|
if BARK:
|
||||||
notify_mode.append('bark')
|
notify_mode.append('bark')
|
||||||
|
@ -57,7 +57,7 @@ if TG_BOT_TOKEN and TG_USER_ID:
|
||||||
if DD_BOT_TOKEN and DD_BOT_SECRET:
|
if DD_BOT_TOKEN and DD_BOT_SECRET:
|
||||||
notify_mode.append('dingding_bot')
|
notify_mode.append('dingding_bot')
|
||||||
print("钉钉机器人 推送打开")
|
print("钉钉机器人 推送打开")
|
||||||
if QYWX_APP:
|
if QYWX_AM:
|
||||||
notify_mode.append('qywxapp_bot')
|
notify_mode.append('qywxapp_bot')
|
||||||
print("企业微信应用 推送打开")
|
print("企业微信应用 推送打开")
|
||||||
|
|
||||||
|
@ -137,11 +137,11 @@ def dingding_bot(title, content):
|
||||||
|
|
||||||
def qywxapp_bot(title, content):
|
def qywxapp_bot(title, content):
|
||||||
print("\n")
|
print("\n")
|
||||||
if not QYWX_APP:
|
if not QYWX_AM:
|
||||||
print("企业微信应用的QYWX_APP未设置!!\n取消推送")
|
print("企业微信应用的QYWX_AM未设置!!\n取消推送")
|
||||||
return
|
return
|
||||||
print("企业微信应用启动")
|
print("企业微信应用启动")
|
||||||
qywx_app_params = QYWX_APP.split(',')
|
qywx_app_params = QYWX_AM.split(',')
|
||||||
url='https://qyapi.weixin.qq.com/cgi-bin/gettoken'
|
url='https://qyapi.weixin.qq.com/cgi-bin/gettoken'
|
||||||
headers= {
|
headers= {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
@ -213,7 +213,7 @@ def qywxapp_bot(title, content):
|
||||||
print('推送失败!')
|
print('推送失败!')
|
||||||
|
|
||||||
def change_user_id(desp):
|
def change_user_id(desp):
|
||||||
qywx_app_params = QYWX_APP.split(',')
|
qywx_app_params = QYWX_AM.split(',')
|
||||||
if qywx_app_params[2]:
|
if qywx_app_params[2]:
|
||||||
userIdTmp = qywx_app_params[2].split("|")
|
userIdTmp = qywx_app_params[2].split("|")
|
||||||
userId = ""
|
userId = ""
|
||||||
|
@ -261,7 +261,7 @@ def send(title, content):
|
||||||
print('未启用 telegram机器人')
|
print('未启用 telegram机器人')
|
||||||
continue
|
continue
|
||||||
elif i == 'qywxapp_bot':
|
elif i == 'qywxapp_bot':
|
||||||
if QYWX_APP:
|
if QYWX_AM:
|
||||||
qywxapp_bot(title=title, content=content)
|
qywxapp_bot(title=title, content=content)
|
||||||
else:
|
else:
|
||||||
print('未启用 企业微信应用推送')
|
print('未启用 企业微信应用推送')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user