Jump to content

Manual:Bots

From mediawiki.org
This page is a translated version of the page Manual:Bots and the translation is 16% complete.

Els bots són eines de programari externes automatitzades que es poden utilitzar per fer treballs tediosos o certes tasques repetitives relacionades amb un wiki. El codi dels bots crida l'API de MediaWiki per fer canvis al wiki.

Els bots es poden utilitzar per a finalitats útils, com ara solucionar redireccions dobles, o un bot RC d'IRC pot publicar canvis recents al vostre wiki en un canal d'IRC. Els bots també es poden utilitzar per a combatre activitats nocives, com ara el vandalisme i el correu brossa (vegeu també Combatent el correu brossa).

WP:CREATEBOT a la Viquipèdia en anglès enumera molts marcs de treball de bots, escrits en diversos llenguatges de programació.

Bot right, group, and flag

Because a bot can make hundreds or even thousands of edits per hour or minute, thus flooding recent changes, user rights should be configured to allow bots to be given a special user right that will prevent their edits from appearing in the default recent changes feed. As this could cause thousands of incorrect or malicious bot edits to go unnoticed for a long time, this right should only be given to bots operated by trusted users.

The "bot" user right

This is the right that grants a user account the ability to perform an edit with a "bot" flag.

  • Not all user accounts with this right are bots.
  • The flag can be toggled on a per-edit basis.

Bot software should activate this flag. But an account can be used by humans and bot software simultaneously. A dedicated bot account will typically have all its edits bot-flagged, but other users may contribute regularly and also run a bot from time to time with their credentials.

  • The "bot" permission may also be temporarily granted to human editors flooding Recent Changes (e.g. using AutoWikiBrowser).

The "bot" user group

The "bot" user group is available in MediaWiki by default to grant a user account the bot right. This is because user management goes by groups, not rights. To grant a user account the bot right, add the user account to a group that provides that right.

  • Group membership can change over time.

There are many bot-flagged edits by user accounts that are no longer in a user group providing the bot right. Likewise there are many edits not bot-flagged by user accounts that now have the bot right (which they may or may not use for each edit).

See API:User group membership for the API to add a user account to the bot group.

On Wikimedia Foundation wikis, not all bots are a member of this group (there are other groups that provide this right, sysop, for example).

The "bot" flag

The "bot" flag is the only reliable factor to identify a bot edit. This indicates most accurately that the edit was intended as bot edit (and that the user could do so because they had the bot user right when the edit was made).

It is especially reliable because the data is stored with the edit, not calculated afterwards, so it isn't affected by the user's group memberships at query time.

However it has one catch: The data is only stored in the recentchanges table, from which it expires after the amount of time configured through $wgRCMaxAge . This may be why this best way is also the least common way to categorize bot edits in analytics (unless only covering recent data).

In the future, the bot flag might be stored in the revision table, thus making it permanently available (T19237).

On Wikimedia Foundation wikis, the "flooder" or "flood" flag gives non-bot user accounts the "bot" permission.

See also