Jump to content

Příručka:Třídy bot Chrise G

From mediawiki.org
This page is a translated version of the page Manual:Chris G's botclasses and the translation is 100% complete.

Chris G's botclasses je PHP MediaWiki robot framework (dříve?) hostovaný na Toolserver. Jsou odvozeny z hodnoty wikibot.classes používané ClueBotem. Viz také w:User:RMCD bot/botclasses.php a https://github.com/legoktm/harej-bots/blob/master/botclasses.php

Roboti

HelloWorldBot.php

<?php
/*
 * HelloWorldBot.php
 * Tento robot upravuje Wikipedii:Sandbox.
/*

/* Nastavte třídy. */
include( 'botclasses.php' );
$wiki      = new wikipedia;
$wiki->url = "https://en.wikipedia.org/w/api.php";
$wiki->setUserAgent( 'User-Agent: FooBot (https://mediawiki.org/wiki/User:FooBot)' );
 
/* Všechny ty věci s přihlášením. */
$user = 'REMOVED';
$pass = 'REMOVED';
$wiki->login( $user, $pass );
 
/* Testovací úprava. */
$page = 'Wikipedia:Sandbox';
$content = 'Hello, world!';
$summary = 'This is a sample bot edit.';
$wiki->edit( $page, $content, $summary );

Ostatní roboti