35 lines
662 B
TypeScript
35 lines
662 B
TypeScript
import netTool from "./netTool";
|
|
|
|
const sendMessage = async (body: any) => {
|
|
const URL = "https://egg.imoaix.cn/message";
|
|
try {
|
|
const res = await netTool.post(URL, JSON.stringify(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,
|
|
});
|
|
};
|
|
|
|
const egg = {
|
|
sendMessage,
|
|
};
|
|
|
|
export default egg;
|