const wxRobot = () => {
const url = `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=555a887d-c247-4808-a850-xyz`;
const fetchPOST = (url, obj) => {
return fetch(
url,
{
method: "POST",
mode: "no-cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(obj),
},
)
.then(res => res.json())
.then(
(json) => {
return json;
}
).catch(err => console.log(`fetch error`, err));
};
// loop
// const trs = [...document.querySelector('[class="issue-table"]')?.lastElementChild?.children] ?? [];
const trs = [...(document.querySelector('[class="issue-table"]') ?? [])]?.lastElementChild?.children ?? [];
for (const tr of trs) {
const link = tr?.firstElementChild?.firstElementChild ?? '';
const text = tr?.firstElementChild?.firstElementChild?.dataset?.issueKey ?? '';
const obj = {
msgtype: "markdown",
markdown: {
content: `
> 分配给我的问题:\n
[${text}](${link})\n
`,
},
};
if(text && link) {
fetchPOST(url, obj);
}
}
}
// 半小时
const timer = 1000 * 60 * 30
setInterval(() => {
wxRobot();
}, timer);
Last active
September 5, 2023 10:15
-
-
Save xgqfrms/134e1308ed028bf7a2936bf361cd66d4 to your computer and use it in GitHub Desktop.
企业微信 robot & Jira (js 版)
trs = [...document.querySelector('[class="issue-table"]')?.lastElementChild?.children] ?? [];
VM133:1 Uncaught TypeError: (intermediate value) is not iterable
at <anonymous>:1:1
(anonymous) @ VM133:1
...document.querySelector('[class="issue-table"]')
VM146:1 Uncaught SyntaxError: Unexpected token '...'
[...document.querySelector('[class="issue-table"]')]
VM175:1 Uncaught TypeError: document.querySelector is not a function or its return value is not iterable
at <anonymous>:1:14
(anonymous) @ VM175:1
document.querySelector('[class="issue-table"]')
null
[...(document.querySelector('[class="issue-table"]' ?? [])]
VM201:1 Uncaught SyntaxError: Unexpected token ']'
[...(document.querySelector('[class="issue-table"]' ?? '')]
VM216:1 Uncaught SyntaxError: Unexpected token ']'
[...(document.querySelector('[class="issue-table"]') ?? [])]
[]
[...(document.querySelector('[class="issue-table"]') ?? [])]
[...(document.querySelector('[class="issue-table"]') ?? [])];
// []
[...(document.querySelector('[class="issue-table"]') ?? [])]?.lastElementChild?.children ?? [];
// []
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
> 引用文字