gitlab_monitor/service/sendMessage.ts
zhaoyingbo 153f15d839
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 30s
CI Monitor CI/CD / deploy (push) Successful in 37s
feat: 更新网络请求工具函数
2024-07-12 07:42:34 +00:00

36 lines
699 B
TypeScript

import netTool from "./netTool";
const API_KEY = "1dfz4wlpbbgiky0";
const sendMessage = async (body: any) => {
const URL = "https://egg.imoaix.cn/message";
try {
const res = await netTool.post(URL, {
api_key: API_KEY,
...body,
});
return res;
} catch {
return null;
}
};
sendMessage.byGroupId = async (group_id: string, content: string) => {
return sendMessage({
group_id,
msg_type: "interactive",
content,
});
};
sendMessage.byChatId = async (chat_id: string, content: string) => {
return sendMessage({
receive_id: chat_id,
receive_id_type: "chat_id",
msg_type: "interactive",
content,
});
};
export default sendMessage;