-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path归零者-cm.js
48 lines (47 loc) · 1.11 KB
/
归零者-cm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"use strict";
const { mw } = require("./mediaWiki");
const api = new mw.Api(require("./config").cm);
(async () => {
await api.login();
const edit = async page => {
let r;
try {
r = await api.post({
action: "edit",
text: "",
nocreate: true,
tags: "Bot",
bot: true,
token: await api.getToken("csrf"),
...page,
});
if (r?.error?.code === "badtoken") {
console.warn("badtoken");
await api.getToken("csrf", true);
return await edit(page);
}
} catch (e) {
console.error(e);
return;
}
if (!r) return;
console.table(r.edit);
if (r.edit.nochange !== true) {
console.info(
`https://zh.moegirl.org.cn/Special:Diff/${r.edit.oldrevid}/${r.edit.newrevid}`
);
}
};
[
{
title: "Template:沙盒",
summary:
"沙盒清理作业,若想保留较长时间,可以在[[特殊:我的用户页/Sandbox|个人测试区]]作测试,或者翻阅历史记录。",
},
{
title: "模块:沙盒",
summary:
"沙盒清理作业,若想保留较长时间,可以在个人测试区作测试,或者翻阅历史记录。",
},
].forEach(edit);
})();