feat: 添加简报收集器功能
All checks were successful
Egg CI/CD / build-image (push) Successful in 5m16s
Egg CI/CD / deploy (push) Successful in 1m23s

This commit is contained in:
zhaoyingbo 2024-05-17 11:56:36 +00:00
parent a280ae9f70
commit 38b8fc61ba
2 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import { fetchCIMonitor } from "../../service";
import { fetchCIMonitor, fetchReportCollector } from "../../service";
import lark from "../../service/lark";
import { LarkMessageEvent } from "../../types";
import { getChatId, getIsEventMsg, getMsgType } from "../../utils/msgTools";
@ -83,6 +83,11 @@ const manageCMDMsg = async (body: LarkMessageEvent) => {
if (text === "/ci") {
msgContent = await fetchCIMonitor();
}
if (text.includes("share") && text.includes("简报")) {
msgContent = await fetchReportCollector(text);
}
if (msgContent) {
await lark.sendMsg("chat_id", chatId, "interactive", msgContent);
return true;

View File

@ -6,3 +6,13 @@ export const fetchCIMonitor = async () => {
return "";
}
};
export const fetchReportCollector = async (msg: string) => {
const url = `https://report.imoaix.cn/report?msg=${msg}`;
try {
const res = await fetch(url);
return ((await res.json()) as string) || "";
} catch {
return "";
}
};