ઢાંચો:Bots/doc: આવૃત્તિઓ વચ્ચેનો તફાવત
Content deleted Content added
Harsh4101991 (ચર્ચા | યોગદાન) નવું પાનું : {{documentation subpage}} <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> These templates tell bots and automated editing tools/scripts that they s... |
નાનું Bot: Replace deprecated <source> tag and "enclose" parameter [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html]; cosmetic changes |
||
લીટી ૪:
These templates tell [[WP:BOT|bots]] and automated editing tools/scripts that they should or should not edit that page. The templates can be used to block most bots (all bots that have implemented this functionality) or specific bots by name or function. For example, this can be used to opt-in or opt-out from user talk bot messages or to cause maintenance bots to avoid certain pages. These templates should be used carefully outside userspace to avoid blocking useful bot edits.
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. 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:
લીટી ૪૮:
'''<nowiki>{{bots|optout=all}}</nowiki>''' Opt out of all messages (see limitations below).
'''<nowiki>{{bots|optout=nosource}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=nolicense}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=orfud}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=norationale}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=replaceable}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=bettersource}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=afd}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=ifd}}</nowiki>''' Opt out of [[
'''<nowiki>{{bots|optout=prod}}</nowiki>''' Opt out of [[
Items can be combined by putting a comma between options
લીટી ૬૨:
'''<nowiki>{{bots|optout=orfud,norationale,replaceable}}</nowiki>''' 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):
#Copyright violation notifications
લીટી ૭૦:
== Implementation ==
*Pywikipediabot supports bots and nobots since r4096. The templates may be ignored using a parameter.
*Since version 3.2.0.0 [[
*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;
લીટી ૮૬:
return true;
}
</syntaxhighlight>
==== Perl ====
<
sub allowBots {
my($text, $user, $opt) = @_;
લીટી ૧૧૪:
return 1;
}
</syntaxhighlight>
==== VB.NET ====
<
Public Shared Function AllowBots(ByVal text As String, ByVal user As String) As Boolean
Return Not Regex.IsMatch(text, "\{\{(nobots|bots\|(allow=none|deny=(?!none).*(" & user.Normalize() & "|all)|optout=all))\}\}", RegexOptions.IgnoreCase)
End Function
</syntaxhighlight>
==== 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);
}
</syntaxhighlight>
==== Java ====
<
public static boolean allowBots(String text, String user)
{
return !text.matches("(?si).*\\{\\{(nobots|bots\\|(allow=none|deny=(.*?" + user + ".*?|all)|optout=all))\\}\\}.*");
}
</syntaxhighlight>
==== 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);
}
</syntaxhighlight>
==== Python ====
<
def allow_bots(text, user):
if (re.search(r'\{\{(nobots|bots\|(allow=none|deny=.*?'+user+r'.*?|optout=all|deny=all))\}\}', text)):
return False
return True
</syntaxhighlight>
== See also ==
* [[m:Template:Bots|Template:Bots]] at Meta.
<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[
[[
<!-- ADD INTERWIKIS BELOW THIS LINE -->
</includeonly>
|