zhaoyingbo 5d9923749b
All checks were successful
CI Monitor MIflow / build-image (push) Successful in 38s
feat: 更新消息服务的URL地址
将消息服务的URL地址从"https://egg.imoaix.cn/message"更新为"https://lark-egg.ai.xiaomi.com/message",以适应新的服务地址。
2024-07-29 08:26:23 +00:00

59 lines
1.1 KiB
TypeScript

import netTool from "../netTool"
const API_KEY = "1dfz4wlpbbgiky0"
const URL = "https://lark-egg.ai.xiaomi.com/message"
const message = async (body: any) => {
try {
const res = await netTool.post(URL, {
api_key: API_KEY,
...body,
})
return res
} catch {
return null
}
}
message.byGroupId = async (group_id: string, content: string) => {
return message({
group_id,
msg_type: "interactive",
content,
})
}
message.byChatId = async (chat_id: string, content: string) => {
return message({
receive_id: chat_id,
receive_id_type: "chat_id",
msg_type: "interactive",
content,
})
}
message.byUserId = async (user_id: string, content: string) => {
return message({
receive_id: user_id,
receive_id_type: "user_id",
msg_type: "interactive",
content,
})
}
message.byUserIdList = async (
user_id_list: string[],
content: string,
api_key?: string
) => {
return message({
receive_id: user_id_list.join(","),
receive_id_type: "user_id",
msg_type: "interactive",
content,
api_key,
})
}
export default message