kanasimi / wikiapi

JavaScript MediaWiki API for node.js
https://kanasimi.github.io/wikiapi/
BSD 3-Clause "New" or "Revised" License
47 stars 5 forks source link

Unexpected edit on bot's userpage #41

Closed hugolpz closed 3 years ago

hugolpz commented 3 years ago

Any idea what is that ?

== [20210408T2243]: 6 pages done ==

Add temporary category to ease next step.
: 6 pages done, 28 s elapsed.
* First, use 476 ms to get 6 pages.
# '''[[:File:Letter-a-colorful.svg]]''' 2 s elapsed,  [[Special:Diff/551289225|finished]] at 20210408T2243
# '''[[:File:Letter-b-colorful.svg]]''' 7 s elapsed,  [[Special:Diff/551289231|finished]] at 20210408T2243
# '''[[:File:Letter-c-colorful.svg]]''' 3 s elapsed,  [[Special:Diff/551289255|finished]] at 20210408T2243
# '''[[:File:Letter-d-colorful.svg]]''' 5 s elapsed,  [[Special:Diff/551289270|finished]] at 20210408T2243
# '''[[:File:Letter-e-colorful.svg]]''' 5 s elapsed,  [[Special:Diff/551289289|finished]] at 20210408T2243
# '''[[:File:Letter-f-colorful.svg]]''' 5 s elapsed,  [[Special:Diff/551289301|finished]] at 20210408T2243

It shown up at the end of this script being run :

// PURPOSE: Script to edit targets using hand-picked targets.
// Run: $node wiki-upload-many.js
const Wikiapi= require('wikiapi');
//const logins = require('./logins.js');
const logins = require('../DragonsBot/logins-ShufaBot.js');
const letters= require('./data/letters.js'); 

// Login credentials from .login*.js
var USER = logins.commons.user,
    PASS = logins.commons.pass,
    API  = logins.commons.api;

(async () => {
    const wiki = new Wikiapi;
    await wiki.login(USER, PASS, API);
    console.log(`Username ${USER} is connected !`);

/* *************************************************************** */
/* CORE ACTION(S) HERE : HACK ME ! ******************************* */
    var listPages = letters.map(item => `File:Letter-${item.letter}-colorful.svg`);
    // Add template {stub}, replace-remove vandalism if any, add category.
    await wiki.for_each_page(
        listPages, 
        d => { return d.wikitext //.replace(/^/g,'Thanos says: ')
            +`\n[[Category:${USER} test: edit]]`; 
            }, // new content
           {bot: 1, nocreate: 0, minor: 1, summary: 'Add temporary category to ease next step.'}  // edit options
   );
/* END CORE ****************************************************** */
/* *************************************************************** */

})();

// For details, see documentation : https://kanasimi.github.io/wikiapi/
kanasimi commented 3 years ago

Sorry, I forgot this. .for_each_page() will generate a report. It can be written to the specified page. I disable the default log just now.

hugolpz commented 3 years ago

Was fun. Looked like bot was alive. I recommend to add some human friendly intro.

=== Work of the day ! ===
Hey, did you noticed what I did today ?!! Isn't this awesome ! :D 
${logs here}

Who is a goooood boy ? (It's me ! 👍🏼 😎 🐕 )

😄

kanasimi commented 3 years ago

The report looks like https://commons.wikimedia.org/wiki/User:Cewbot/log/20190913