ઢાંચો:Bots/doc: આવૃત્તિઓ વચ્ચેનો તફાવત

Content deleted Content added
નવું પાનું : {{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 [[Templateઢાંચો:Image source|no source]] messages.
'''<nowiki>{{bots|optout=nolicense}}</nowiki>''' Opt out of [[Templateઢાંચો:Image copyright request|no license]] messages.
'''<nowiki>{{bots|optout=orfud}}</nowiki>''' Opt out of [[Templateઢાંચો:Di-orphaned fair use-notice|orphaned fair use]] messages.
'''<nowiki>{{bots|optout=norationale}}</nowiki>''' Opt out of [[Templateઢાંચો:Missing rationale|no rationale]] messages.
'''<nowiki>{{bots|optout=replaceable}}</nowiki>''' Opt out of [[Templateઢાંચો:Di-replaceable fair use-notice|replaceable fair use]] messages.
'''<nowiki>{{bots|optout=bettersource}}</nowiki>''' Opt out of [[Templateઢાંચો:Bsr-user|better source request]] messages.
'''<nowiki>{{bots|optout=afd}}</nowiki>''' Opt out of [[Templateઢાંચો:AFDWarningNew|articles for deletion]] messages or [[Templateઢાંચો:AFDWarning|variant]] [[Templateઢાંચો:Adw|forms]].
'''<nowiki>{{bots|optout=ifd}}</nowiki>''' Opt out of [[Templateઢાંચો:Idw|images for deletion]] messages or [[Templateઢાંચો:Idw-multi|variant]].
'''<nowiki>{{bots|optout=prod}}</nowiki>''' Opt out of [[Templateઢાંચો:PRODWarning|prod warning]] messages or [[Templateઢાંચો:PRODNote|variant]].
 
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 [[Wikipediaવિકિપીડિયા:AutoWikiBrowser|AutoWikiBrowser]] fully supports <nowiki>{{bots}} and {{nobots}}</nowiki>. 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 ====
<sourcesyntaxhighlight lang="php">
function allowBots( $text ) {
global $user;
લીટી ૮૬:
return true;
}
</syntaxhighlight>
</source>
 
==== Perl ====
 
<sourcesyntaxhighlight lang="perl">
sub allowBots {
my($text, $user, $opt) = @_;
લીટી ૧૧૪:
return 1;
}
</syntaxhighlight>
</source>
 
==== VB.NET ====
<sourcesyntaxhighlight lang="vbnet">
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>
</source>
 
==== C# ====
<sourcesyntaxhighlight lang="csharp">
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>
</source>
 
==== Java ====
<sourcesyntaxhighlight lang="java">
public static boolean allowBots(String text, String user)
{
return !text.matches("(?si).*\\{\\{(nobots|bots\\|(allow=none|deny=(.*?" + user + ".*?|all)|optout=all))\\}\\}.*");
}
</syntaxhighlight>
</source>
 
==== JavaScript ====
<sourcesyntaxhighlight lang="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>
</source>
 
==== Python ====
<sourcesyntaxhighlight lang="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>
</source>
 
== See also ==
* [[m:Template:Bots|Template:Bots]] at Meta.
 
<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[Categoryશ્રેણી:Wikipedia utility templates]]
[[Categoryશ્રેણી:Wikipedia bot-related templates]]
<!-- ADD INTERWIKIS BELOW THIS LINE -->
[[as:Template:Bots]]
[[bg:Шаблон:Bots]]
[[cs:Šablona:Nobots]]
[[de:Vorlage:Bots]]
[[et:Mall:Bots]]
[[eo:Ŝablono:Bots]]
[[fa:الگو:Nobots]]
[[fr:Modèle:Nobots]]
[[hu:Sablon:Bots]]
[[it:Template:Bots]]
[[ja:Template:Bots]]
[[ko:틀:Bots]]
[[ku:Şablon:Nobots]]
[[nl:sjabloon:Bots]]
[[no:Mal:Bots]]
[[pl:Szablon:Bots]]
[[pt:Predefinição:Robôs]]
[[ru:Шаблон:Bots]]
[[sl:Predloga:Bots]]
[[fi:Malline:Bots]]
[[th:แม่แบบ:Bots]]
[[ur:سانچہ:Bots]]
[[zh:Template:Bots]]
[[zh-yue:Template:Bots]]
</includeonly>