mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 13:48:03 +08:00
🔨 修改企业微信应用消息通知类型及方式,修复字数限制的问题。
This commit is contained in:
parent
1dce0ea187
commit
04f1aa5f0b
@ -137,7 +137,6 @@ class Cloud189CheckIn:
|
||||
else:
|
||||
sign_msg = flag
|
||||
msg = f"【天翼云盘】\n帐号信息: {cloud189_phone}\n{sign_msg}"
|
||||
print(msg)
|
||||
msg_list.append(msg)
|
||||
return msg_list
|
||||
|
||||
|
2
index.py
2
index.py
@ -57,7 +57,7 @@ def main_handler(event, context):
|
||||
print(e)
|
||||
msg_list = []
|
||||
content_list += msg_list
|
||||
content_list.append(f"本次任务使用时间: {time.time() - start_time} 秒")
|
||||
content_list.append(f"任务使用时间: {int(time.time() - start_time)} 秒")
|
||||
if message == "xmly":
|
||||
if utc_time.hour in [9, 18] and utc_time.minute == 0:
|
||||
flag = True
|
||||
|
@ -95,7 +95,17 @@ def message2qywxapp(qywx_corpid, qywx_agentid, qywx_corpsecret, qywx_touser, con
|
||||
f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={qywx_corpid}&corpsecret={qywx_corpsecret}"
|
||||
)
|
||||
token = res.json().get("access_token", False)
|
||||
data = {"touser": qywx_touser, "msgtype": "text", "agentid": qywx_agentid, "text": {"content": content}}
|
||||
data = {
|
||||
"touser": qywx_touser,
|
||||
"agentid": qywx_agentid,
|
||||
"msgtype": "textcard",
|
||||
"textcard": {
|
||||
"title": "签到通知",
|
||||
"description": content,
|
||||
"url": "https://github.com/Sitoi/dailycheckin",
|
||||
"btntxt": "开源项目"
|
||||
}
|
||||
}
|
||||
requests.post(url=f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}", data=json.dumps(data))
|
||||
return
|
||||
|
||||
@ -150,13 +160,24 @@ def push_message(content_list: list, notice_info: dict):
|
||||
try:
|
||||
message2coolpush(
|
||||
coolpushskey=coolpushskey,
|
||||
content=content,
|
||||
coolpushqq=coolpushqq,
|
||||
coolpushwx=coolpushwx,
|
||||
coolpushemail=coolpushemail,
|
||||
content=content,
|
||||
)
|
||||
except Exception as e:
|
||||
print("coolpush 推送失败", e)
|
||||
if qywx_touser and qywx_corpid and qywx_corpsecret and qywx_agentid:
|
||||
try:
|
||||
message2qywxapp(
|
||||
qywx_corpid=qywx_corpid,
|
||||
qywx_agentid=qywx_agentid,
|
||||
qywx_corpsecret=qywx_corpsecret,
|
||||
qywx_touser=qywx_touser,
|
||||
content=content,
|
||||
)
|
||||
except Exception as e:
|
||||
print("企业微信应用消息推送失败", e)
|
||||
for message in message_list:
|
||||
if dingtalk_access_token and dingtalk_secret:
|
||||
try:
|
||||
@ -185,17 +206,6 @@ def push_message(content_list: list, notice_info: dict):
|
||||
message2qywxrobot(qywx_key=qywx_key, content=message)
|
||||
except Exception as e:
|
||||
print("企业微信群机器人推送失败", e)
|
||||
if qywx_touser and qywx_corpid and qywx_corpsecret and qywx_agentid:
|
||||
try:
|
||||
message2qywxapp(
|
||||
qywx_corpid=qywx_corpid,
|
||||
qywx_agentid=qywx_agentid,
|
||||
qywx_corpsecret=qywx_corpsecret,
|
||||
qywx_touser=qywx_touser,
|
||||
content=message,
|
||||
)
|
||||
except Exception as e:
|
||||
print("企业微信应用消息推送失败", e)
|
||||
if tg_user_id and tg_bot_token:
|
||||
try:
|
||||
message2telegram(tg_user_id=tg_user_id, tg_bot_token=tg_bot_token, content=message)
|
||||
|
Loading…
Reference in New Issue
Block a user