45 lines
867 B
TypeScript
45 lines
867 B
TypeScript
import netTool from "../netTool";
|
|
|
|
const API_KEY = "1dfz4wlpbbgiky0";
|
|
const URL = "https://egg.imoaix.cn/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,
|
|
});
|
|
};
|
|
|
|
export default message;
|