feat: 添加简报收集器功能
This commit is contained in:
parent
a280ae9f70
commit
38b8fc61ba
@ -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;
|
||||
|
@ -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 "";
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user