Apologies to those seeing this twice, but it's important enough to announce
widely.

---------- Forwarded message ----------
From: Matthew Flaschen <mflasc...@wikimedia.org>
Date: Tue, Sep 29, 2015 at 4:05 PM
Subject: [Mediawiki-api] Tips for using bots and user scripts with Flow
To: mediawiki-api@lists.wikimedia.org, EE List <e...@lists.wikimedia.org>


Flow will start appearing more widely soon when we release a feature to
allow users on certain wikis to opt into Flow on their user talk pages.

The most common thing you'll probably want to do on a Flow page is post a
new topic.

For Pywikibot, that is pretty easy, since they have Flow support now. See
https://www.mediawiki.org/wiki/Manual:Pywikibot/Flow .

For on-wiki scripts, you can use MessagePoster (you don't need to know if
it's a Flow board ahead of time!):

---
        var title = new mw.Title( 'titleString' );
        var posterPromise = mw.messagePoster.factory.create( title );
        posterPromise.done( function ( poster ) {
                poster.post( 'This is the topic title', 'This is the body
of a message posted with MessagePoster' );
        } );
---

Depend on 'mediawiki.messagePoster' and 'mediawiki.Title'.

In some cases, you might want to check if a link is already there (e.g. to
see if a warning template already included links to a particular policy).
You can use prop=links for this.

Flow is based on an infinitely-scrollable list of topics, each of which is
its own page.  So to use prop=links, you may need to loop through a set of
recent enough topics (e.g. 25) then combine them into a prop=links request,
e.g.
https://www.mediawiki.org/w/api.php?action=query&titles=Topic:Sojpiv245cuiw67c|Topic:Sojs3simnwvh96fk&prop=links
.

pywikibot has support for looping through topics.

Some bots need to check the header of a page for wikitext (e.g. a bot
exclusion template).  This can be done with view-header, but I don't think
pywikibot has support for that yet (but it can be done directly).  See
https://www.mediawiki.org/w/api.php?action=flow&format=jsonfm&page=Talk%3AFlow&submodule=view-header&vhformat=wikitext
.

A better way to do this would be templatelinks, but I'm not sure if there
is an API to show templates PageX transcludes.

For other questions, contact us at #wikimedia-collaboration .  Or, if a
certain tool needs Flow support and you're not sure where to start, you can
file a bug (you can also reply here, but a ping in IRC would be
appreciated).

Matt Flaschen
_______________________________________________
Mediawiki-api-announce mailing list
mediawiki-api-annou...@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to