-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwiki-monitor-recent_changes.js
29 lines (25 loc) · 1.08 KB
/
wiki-monitor-recent_changes.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
// PURPOSE: Script reads Special:RecentChanges for main namespace and associated talkpage.
// Run: $node wiki-monitor-recent_changes.js
const Wikiapi= require('wikiapi');
const logins = require('./logins.js');
// Login credentials from .login*.js
var USER = logins.commons.user,
PASS = logins.commons.pass,
API = logins.commons.api;
(async () => {
const targetWiki = new Wikiapi;
await targetWiki.login(USER, PASS, API);
console.log(`Username ${USER.split('@')[0]} is connected !`);
/* *************************************************************** */
/* CORE ACTION(S) HERE : HACK ME ! ******************************* */
// Listen to new edits, check every 2 minutes
targetWiki.listen(function for_each_row() { ... }, {
delay: '2m',
filter: function filter_row() { ... },
// get diff
with_diff: { LCS: true, line: true },
namespace: '0|talk', // <-------- Main namespace and its talkpages.
});
/* END CORE ****************************************************** */
/* *************************************************************** */
})();