MWBot library
Meta
- author: Simon Heimler
Constructs a new MWBot instance It is advised to create one bot instance for every API to use A bot instance has its own state (e.g. tokens) that is necessary for some operations
Parameters
customOptions
[{}] Custom optionscustomRequestOptions
[{}] Custom request options
Get mwbot ersion number
Set and overwrite msbot options
Parameters
customOptions
{}
Sets and overwrites the raw request options, used by the "request" library See https://www.npmjs.com/package/request
Parameters
customRequestOptions
{}
Sets the API URL for MediaWiki requests This can be uses instead of a login, if no actions are used that require one.
Parameters
apiUrl
String API Url to MediaWiki, e.g. 'https://www.semantic-mediawiki.org/w/api.php'
Executes a promisified raw request Uses the npm request library
Parameters
requestOptions
object
Returns bluebird
Executes a request with the ability to use custom parameters and custom request options
Parameters
Returns bluebird
Executes a Login
Parameters
loginOptions
[object]
Returns bluebird
Gets an edit token This is currently only compatible with MW >= 1.24
Returns bluebird
Combines Login with GetEditToken
Parameters
loginOptions
Returns bluebird
Creates a new wiki pages. Does not edit existing ones
Parameters
Returns bluebird
Reads the content / and meta-data of one (or many) wikipages
Parameters
Returns bluebird
Updates existing new wiki pages. Does not create new ones
Parameters
Returns bluebird
Deletes a new wiki page
Parameters
Returns bluebird
Edits a new wiki pages. Creates a new page if it does not exist yet
Parameters
Returns bluebird
Uploads a file
Parameters
title
[string]pathToFile
stringcomment
[string]customParams
[object]customRequestOptions
[object]
Returns bluebird
Uploads a file and overwrites existing ones
Parameters
title
[string]pathToFile
stringcomment
[string]customParams
[object]customRequestOptions
[object]
Returns bluebird
Combines all standard CRUD operations into one concurrent batch operation The batch request will also print log messages about the current job status It includes some more detailed error handling
If the concurrency is set to 1, it ensures a sequential order by switching from Promise.map to Promise.mapSeries
Parameters
Executes a SPARQL Query Defaults to use the wikidata endpoint
Parameters
Returns bluebird
Execute an ASK Query
Parameters
Returns bluebird
Recursively merges two objects
Parameters
Returns object Merged Object
Prints status information about a completed request
Parameters
status
currentCounter
totalCounter
operation
pageName
reason
Provide bluebird.js Promise
Provide bluebird.js Promise.map for concurrent batch requests
Provide bluebird.js Promise.mapSeries for sequential batch requests