ଛାଞ୍ଚ:Bots

ଉଇକିପିଡ଼ିଆ ରୁ
[view] [edit] [history] [purge] Documentation icon Template documentation

This is a template for pages to specify whether or not they want visits from any bots, most bots or specific bots. This can be used to easily and explicitly opt-in or opt-out of unsolicited bot posts to user pages or to cause maintenance bots to avoid certain pages. Explicitly opting-in has the advantage of possibly receiving useful changes or targeted posts that might otherwise be skipped by the bot assuming a default "opt-out" behavior. These templates should be used mainly on the "User" and "User talk" namespaces and should be used carefully in other spaces.

Users should be aware that by opting-out of bot posts, they will not be notified of matters relating to material they have edited or uploaded, which are tagged or scanned by bots per policy.

In particular, in the encyclopedia spaces:

  • Avoid using the template as a blunt instrument
  • Address the root problem with the bot owner or bot community
  • Remove the template tag once the underlying problem has been resolved.

Syntax:[ସମ୍ପାଦନା]

{{nobots}}                Ban all compliant bots (shortcut)
{{bots}}                  Allow all bots (shortcut)
{{bots|allow=<botlist>}}  Ban all compliant bots not in the list
{{bots|deny=<botlist>}}   Ban all compliant bots in the list
Where <botlist> is a comma-delimited string of bot usernames (AWB can be used for all AWB-based bots):
  {{bots|allow=HagermanBot,Werdnabot}}
  {{bots|deny=AWB}}
<botlist> can also be "none" or "all" as in the following examples:
  {{bots|allow=all}}      Allow all bots
  {{bots|allow=none}}     Ban all compliant bots
  {{bots|deny=all}}       Ban all compliant bots
  {{bots|deny=none}}      Allow all bots

Bots are not bound to observe the nobots tag, it will depend on their functionality, their owners and their terms of approval. The bots which currently support exclusion are listed at exclusion compliant bots.

Message notification opt out[ସମ୍ପାଦନା]

Another option is to opt out of specific types of messages for users who wish to be notified of certain problems, but not others. Users should be aware that by opting-out of specific notification posts, they will not be notified of matters relating to material they have edited or uploaded, which are tagged per policy. Actions (such as deletion) may be executed without you being notified as a result. By applying this to your own user talk page, you agree to this consequence. Applying this to a user talk page other than your own will be considered vandalism. All bots and scripts that leave messages on a user's talk page are encouraged to add this capability.

By adding this to a user's talk page, a user may still receive these messages by non-compliant bots or scripts, or humans who add the tag manually.

{{bots|optout=all}}            Opt out of all messages (see limitations below).
{{bots|optout=nosource}}       Opt out of no source messages.
{{bots|optout=nolicense}}      Opt out of no license messages.
{{bots|optout=orfud}}          Opt out of orphaned fair use messages.
{{bots|optout=norationale}}    Opt out of no rationale messages.
{{bots|optout=replaceable}}    Opt out of replaceable fair use messages.
{{bots|optout=bettersource}}   Opt out of better source request messages.
{{bots|optout=afd}}            Opt out of articles for deletion messages or variant forms.
{{bots|optout=ifd}}            Opt out of images for deletion messages or variant.
{{bots|optout=prod}}           Opt out of prod warning messages or variant.

Items can be combined by putting a comma between options

{{bots|optout=nosource,nolicense}}                 Opt out of no source, and no license messages.
{{bots|optout=orfud,norationale,replaceable}}      Opt out of fair use messages.

Restrictions of messages that can be opted out[ସମ୍ପାଦନା]

Some message notifications are not allowed to be opted out. These include (but are not limited to):

  1. Copyright violation notifications
  2. Vandalism (and other) warning notices.
  3. Any message tag that isn't included as a way of opting out above. (Is there one that should be included? Leave a message on the talk page.)

Implementation[ସମ୍ପାଦନା]

  • Pywikipediabot supports bots and nobots since r4096. The templates may be ignored using a parameter.
  • Since version 3.2.0.0 AutoWikiBrowser fully supports {{bots}} and {{nobots}}. Additionally, pseudo-username AWB can be specified to ban all AWB-based bots from the page. However, AWB has an option to ignore these templates.
  • Opt out message notification was introduced here April 3, 2008. Individual bot/script implementation will vary and notice above of implementation may not include this feature.

Example implementations[ସମ୍ପାଦନା]

PHP[ସମ୍ପାଦନା]

function allowBots( $text ) {
    global $user;
    if (preg_match('/\{\{(nobots|bots\|allow=none|bots\|deny=all|bots\|optout=all|bots\|deny=.*?'.preg_quote($user,'/').'.*?)\}\}/iS',$text)) { return false; }
    return true;
}

Perl[ସମ୍ପାଦନା]

sub allowBots {
    my($text, $user, $opt) = @_;
    return 0 if $text =~ /{{nob[o]ts}}/;
    return 1 if $text =~ /{{b[o]ts}}/;
    if($text =~ /{{bots\s*\|\s*allow\s*=\s*(.*?)\s*}}/s){
        return 1 if $1 eq 'all';
        return 0 if $1 eq 'none';
        my @bots = split(/\s*,\s*/, $1);
        return (grep $_ eq $user, @bots)?1:0;
    }
    if($text =~ /{{bots\s*\|\s*deny\s*=\s*(.*?)\s*}}/s){
        return 0 if $1 eq 'all';
        return 1 if $1 eq 'none';
        my @bots = split(/\s*,\s*/, $1);
        return (grep $_ eq $user, @bots)?0:1;
    }
    if(defined($opt) && $text =~ /{{bots\s*\|\s*optout\s*=\s*(.*?)\s*}}/s){
        return 0 if $1 eq 'all';
        my @opt = split(/\s*,\s*/, $1);
        return (grep $_ eq $opt, @opt)?0:1;
    }
    return 1;
}

C#[ସମ୍ପାଦନା]

public static bool AllowBots(string text, string user)
{
    return !Regex.IsMatch(text, @"\{\{(nobots|bots\|(allow=none|deny=(?!none).*(" + user.Normalize() + @"|all)|optout=all))\}\}", RegexOptions.IgnoreCase);
}

Java[ସମ୍ପାଦନା]

public static boolean AllowBots(String text, String user)
{
      return !Regex.Match(text, "\\{\\{(nobots|bots\\|(allow=none|deny=(.*?" + user.Normalize() + ".*?|all)|optout=all))\\}\\}", RegexOptions.IgnoreCase).Success;
}

JavaScript[ସମ୍ପାଦନା]

function allowBots(text, user){
  if (!new RegExp("\\{\\{\\s*(nobots|bots[^}]*)\\s*\\}\\}", "i").test(text)) return true;
  return (new RegExp("\\{\\{\\s*bots\\s*\\|\\s*deny\\s*=\\s*([^}]*,\\s*)*"+user+"\\s*(?=[,\\}])[^}]*\\s*\\}\\}", "i").test(text)) ? false : new RegExp("\\{\\{\\s*((?!nobots)|bots(\\s*\\|\\s*allow\\s*=\\s*((?!none)|([^}]*,\\s*)*"+user+"\\s*(?=[,\\}])[^}]*|all))?|bots\\s*\\|\\s*deny\\s*=\\s*(?!all)[^}]*|bots\\s*\\|\\s*optout=(?!all)[^}]*)\\s*\\}\\}", "i").test(text);
}

Python[ସମ୍ପାଦନା]

def Allowbots(text, user):
    if (re.search(r'\{\{(nobots|bots\|(allow=none|deny=.*?' + user + r'.*?|optout=all|deny=all))\}\}', text)):
        return False
    return True

See also[ସମ୍ପାଦନା]
http://or.wikipedia.org/wiki/%E0%AC%9B%E0%AC%BE%E0%AC%9E%E0%AD%8D%E0%AC%9A:Bots
or.wikipedia.org
crawl=CC-MAIN-2014-10
95262
application/http; msgtype=response
sha1:U3P3XEE4B6AUEKM3YYL4JF6V4WDBEMCN
<urn:uuid:15579c06-a97f-4998-b4b8-1cfa4ac13b66>
2014-03-11T22:49:13Z
208.80.154.224
sha1:42C3UJ3LMTHYWKXELKFZT7IG6P6V4VAG
<urn:uuid:b52249f9-51fe-4fb0-af81-70191f80fbd7>
http://or.wikipedia.org/wiki/%E0%AC%9B%E0%AC%BE%E0%AC%9E%E0%AD%8D%E0%AC%9A:Bots
response
<urn:uuid:7395641c-13cc-4642-9a69-f867c08eb6d9>
robots: classic
hostname: ip-10-183-142-35.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2014-10
operator: CommonCrawl Admin
description: Wide crawl of the web with URLs provided by Blekko for March 2014
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf