mirror of
https://github.com/ihmily/DouyinLiveRecorder.git
synced 2025-12-26 05:48:32 +08:00
feat: add dingtalk atall (#795)
This commit is contained in:
parent
14552afcdf
commit
b3449093bb
@ -37,6 +37,7 @@ bark推送接口链接 =
|
||||
bark推送中断级别 = active
|
||||
bark推送铃声 =
|
||||
钉钉通知@对象(填手机号) =
|
||||
钉钉通知@全体(是/否) = 否
|
||||
tgapi令牌 =
|
||||
tg聊天id(个人或者群组id) =
|
||||
smtp邮件服务器 =
|
||||
|
||||
3
main.py
3
main.py
@ -292,7 +292,7 @@ def push_message(record_name: str, live_url: str, content: str) -> None:
|
||||
msg_title = push_message_title.strip() or "直播间状态更新通知"
|
||||
push_functions = {
|
||||
'微信': lambda: xizhi(xizhi_api_url, msg_title, content),
|
||||
'钉钉': lambda: dingtalk(dingtalk_api_url, content, dingtalk_phone_num),
|
||||
'钉钉': lambda: dingtalk(dingtalk_api_url, content, dingtalk_phone_num, dingtalk_is_atall),
|
||||
'邮箱': lambda: send_email(
|
||||
email_host, login_email, email_password, sender_email, sender_name,
|
||||
to_email, msg_title, content
|
||||
@ -1586,6 +1586,7 @@ while True:
|
||||
bark_msg_level = read_config_value(config, '推送配置', 'bark推送中断级别', "active")
|
||||
bark_msg_ring = read_config_value(config, '推送配置', 'bark推送铃声', "bell")
|
||||
dingtalk_phone_num = read_config_value(config, '推送配置', '钉钉通知@对象(填手机号)', "")
|
||||
dingtalk_is_atall = options.get(read_config_value(config, '推送配置', '钉钉通知@全体(是/否)', "否"), False)
|
||||
tg_token = read_config_value(config, '推送配置', 'tgapi令牌', "")
|
||||
tg_chat_id = read_config_value(config, '推送配置', 'tg聊天id(个人或者群组id)', "")
|
||||
email_host = read_config_value(config, '推送配置', 'SMTP邮件服务器', "")
|
||||
|
||||
@ -22,7 +22,7 @@ opener = urllib.request.build_opener(no_proxy_handler)
|
||||
headers: Dict[str, str] = {'Content-Type': 'application/json'}
|
||||
|
||||
|
||||
def dingtalk(url: str, content: str, number: str = None) -> Dict[str, Any]:
|
||||
def dingtalk(url: str, content: str, number: str = None, is_atall: bool = False) -> Dict[str, Any]:
|
||||
success = []
|
||||
error = []
|
||||
api_list = url.replace(',', ',').split(',') if url.strip() else []
|
||||
@ -36,6 +36,7 @@ def dingtalk(url: str, content: str, number: str = None) -> Dict[str, Any]:
|
||||
"atMobiles": [
|
||||
number
|
||||
],
|
||||
"isAtAll": is_atall
|
||||
},
|
||||
}
|
||||
try:
|
||||
@ -214,6 +215,7 @@ if __name__ == '__main__':
|
||||
# 钉钉推送通知
|
||||
webhook_api = '' # 替换成自己Webhook链接,参考文档:https://open.dingtalk.com/document/robots/custom-robot-access
|
||||
phone_number = '' # 被@用户的手机号码
|
||||
is_atall = '' # 是否@全体
|
||||
# dingtalk(webhook_api, send_content, phone_number)
|
||||
|
||||
# 微信推送通知
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user