gitlab_monitor/service/sendMessage.ts
zhaoyingbo f66bf4b39c
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 28s
CI Monitor CI/CD / deploy (push) Successful in 45s
feat: 添加发送消息的API密钥
2024-07-12 06:46:42 +00:00

35 lines
701 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, body);
return res;
} catch {
return null;
}
};
sendMessage.byGroupId = async (group_id: string, content: string) => {
return sendMessage({
api_key: API_KEY,
group_id,
msg_type: "interactive",
content,
});
};
sendMessage.byChatId = async (chat_id: string, content: string) => {
return sendMessage({
api_key: API_KEY,
receive_id: chat_id,
receive_id_type: "chat_id",
msg_type: "interactive",
content,
});
};
export default sendMessage;