diff --git a/contact-xbot.py b/contact-xbot.py index 2d6dea2..e984cca 100644 --- a/contact-xbot.py +++ b/contact-xbot.py @@ -184,11 +184,25 @@ def feishu_notify(text): data = res.read() +def feishu_notify_to_xbot_content_group(text): + + webhook_url = "/open-apis/bot/v2/hook/b2db78ac-799a-4251-8341-18d49091fa62" + Keys = "T8phm8fcfZ04bvOHaI0kzd" + + conn = http.client.HTTPSConnection("open.feishu.cn") + payload = json.dumps({"msg_type": "text", "content": {"text": text}}) + headers = {"Content-Type": "application/json"} + conn.request("POST", webhook_url, payload, headers) + res = conn.getresponse() + data = res.read() + + def main(): """ 主程序入口 """ messages = [] + message_without_phone = [] try: # 获取所有工单 work_orders = get_all_work_orders() @@ -217,13 +231,21 @@ def main(): # 通知提交者 messages.append( - f"工单ID: {processed_order['uuid']}\n" + # f"工单ID: {processed_order['uuid']}\n" f"提交者: {processed_order['submitter']}\n" + f"标题: {processed_order['title']}\n" f"电话: {processed_order['phone']}\n" f"企业: {processed_order['enterprise'] or '未找到'}\n" f"邀约: 我是影刀的小伙伴, 想跟你沟通反馈的需求: {processed_order['content']}\n\n" ) + message_without_phone.append( + f"工单ID: {processed_order['uuid']}\n" + f"提交者: {processed_order['submitter']}\n" + f"标题: {processed_order['title']}\n" + f"企业: {processed_order['enterprise'] or '未找到'}\n" + ) + transfer_work_order( processed_order["uuid"], CONFIG.get("newDutyUuid"), @@ -234,6 +256,11 @@ def main(): print("发送飞书通知") feishu_notify(text=messages) + if message_without_phone.strip(): + message_without_phone = "\n".join(message_without_phone) + print("发送飞书通知") + feishu_notify_to_xbot_content_group(text=message_without_phone) + except requests.RequestException as e: print(f"请求发生错误: {e}") except Exception as e: