MediaWiki-Bot

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

            my $user = $entry->{'title'};
            print "$user\n";
        }
    
        $bot->get_log({
                type => 'block',
                user => 'User:Mike.lifeguard',
            },
            { hook => \&mysub, max => 10 }
        );
        sub mysub {
            my ($res) = @_;
            foreach my $hashref (@$res) {
                my $title = $hashref->{'title'};
                print "$title\n";
            }
        }

    References: API:Logevents
    <https://www.mediawiki.org/wiki/API:Logevents>

 is_g_blocked

        my $is_globally_blocked = $bot->is_g_blocked('127.0.0.1');

    Returns what IP/range block currently in place affects the IP/range.
    The return is a scalar of an IP/range if found (evaluates to true in
    boolean context); undef otherwise (evaluates false in boolean context).
    Pass in a single IP or CIDR range.

    References: Extension:GlobalBlocking
    <https://www.mediawiki.org/wiki/Extension:GlobalBlocking/API>

 was_g_blocked

        print "127.0.0.1 was globally blocked\n" if $bot->was_g_blocked('127.0.0.1');

    Returns whether an IP/range was ever globally blocked. You should
    probably call this method only when your bot is operating on Meta -
    this method will warn if not.

    References: API:Logevents
    <https://www.mediawiki.org/wiki/API:Logevents>

 was_locked

        my $was_locked = $bot->was_locked('Mike.lifeguard');

    Returns whether a user was ever locked. You should probably call this
    method only when your bot is operating on Meta - this method will warn
    if not.

    References: API:Logevents
    <https://www.mediawiki.org/wiki/API:Logevents>

 get_protection

    Returns data on page protection as a array of up to two hashrefs. Each
    hashref has a type, level, and expiry. Levels are 'sysop' and
    'autoconfirmed'; types are 'move' and 'edit'; expiry is a timestamp.
    Additionally, the key 'cascade' will exist if cascading protection is
    used.

        my $page = 'Main Page';
        $bot->edit({
            page    => $page,
            text    => rand(),
            summary => 'test',
        }) unless $bot->get_protection($page);

    You can also pass an arrayref of page titles to do bulk queries:

        my @pages = ('Main Page', 'User:Mike.lifeguard', 'Project:Sandbox');
        my $answer = $bot->get_protection(\@pages);
        foreach my $title (keys %$answer) {
            my $protected = $answer->{$title};
            print "$title is protected\n" if $protected;
            print "$title is unprotected\n" unless $protected;
        }

    References: API:Properties#info
    <https://www.mediawiki.org/wiki/API:Properties#info_.2F_in>

 is_protected

    This is a synonym for "get_protection", which should be used in
    preference.

    This method is deprecated, and will emit deprecation warnings.

 patrol

        $bot->patrol($rcid);

    Marks a page or revision identified by the $rcid as patrolled. To mark
    several RCIDs as patrolled, you may pass an arrayref of them. Returns
    false and sets $bot->{error} if the account cannot patrol.

    References: API:Patrol <https://www.mediawiki.org/wiki/API:Patrol>

 email

        $bot->email($user, $subject, $body);

    This allows you to send emails through the wiki. All 3 of $user
    (without the User: prefix), $subject and $body are required. If $user
    is an arrayref, this will send the same email (subject and body) to all
    users.

    References: API:Email <https://www.mediawiki.org/wiki/API:Email>

 top_edits

    Returns an array of the page titles where the $user is the latest
    editor. The second parameter is the familiar $options_hashref.

        my @pages = $bot->top_edits("Mike.lifeguard", {max => 5});
        foreach my $page (@pages) {
            $bot->rollback($page, "Mike.lifeguard");
        }



( run in 1.263 second using v1.01-cache-2.11-cpan-5837b0d9d2c )