Template talk:Bots/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1

HagermanBot is NoBots Aware!

I'm pleased to announce that HagermanBot now recognizes the syntax for this template. Although the previous <!--Disable HagermanBot--> tag is still supported for legacy talk pages, the preferred and documented method to disable the bot for a specific page is to use this template. Thanks! Hagerman(talk) 04:27, 18 December 2006 (UTC)

Where can these be used?

Is there any consensus on the appropriate use of these templates? If someone wants to put them on their User: or User talk: page, fine, since that's a personal page. I would propose, however, that they should not be allowed at all on main namespace pages -- no Wikipedia editor has the right to dictate who else may or may not edit an article. And their use should be highly discouraged in any other namespace, unless a consensus is first developed that they are appropriate in a particular context. --Russ (talk) 20:00, 20 December 2006 (UTC)

We're not telling a specific user whether or not they can edit a page. What we are doing is using it to manage bots more efficiently. We don't allow bots to edit every type of page, and using these tags is no different than another efficient control mechanism. If it were abused, that'd be one thing. Currently the Wikipedia:Reference_desk/guidelines page has a {{nobots}} tag to keep HagermanBot (only) from taking messages as "unsigned" on that page. Frankly, i'm not even sure why the bot was editing that page, but that's another issue altogether. Ignoring that point, the use of the tag was appropriate in that case. Also, since this is effectively a fine-tune bot control mechanism, this makes it easier to maintain black and white lists for ALL bots for certain specific pages. If the bot approvals process wanted to approve a bot that could/should ignore the template, it would do so. The template is not a hard and fast rule, so it doesn't do more than ask that a bot refuse to edit the page, not that it can't. -- RM 20:42, 20 December 2006 (UTC)
There are specific cases where a general "good" edit would be bad, for example the article on common misspellings, which may be a main space candidate for this template. Rich Farmbrough, 22:32 20 December 2006 (GMT).
Also, a compliant bot doesn't need to just ignore the page. It can spit back warning messages so that the bot operator can manually check a page. In cases like the above example, I can't think of any harm that would be caused by "forcing" the bot to skip the page because it is "high risk" for bot mistakes. Of course the intention is that every user would place these templates on their user and user talk pages to explicitly state their intentions regarding bots. -- RM 14:19, 21 December 2006 (UTC)
It looks like the reason the bot was editing the guidelines page is because the Wikipedia:Reference desk page has a Category:Non-talk pages with subpages automatically signed by HagermanBot category applied to it. That means that any sub page of the Reference Desk will be monitored for unsigned comments. The original implementation I made had a Category:Non-talk pages automatically signed by HagermanBot category on each of the individual reference pages, however, it looks like the format has been changed. Nonetheless, with the {{bots}} tag it's still just as effective. Best, Hagerman(talk) 05:52, 22 December 2006 (UTC)

Name Change?

I like the changes RM made to the syntax with the "all" and "none" settings. However, looking at the code {{nobots|allow=all}} in plain english seems like it might confuse an end-user. Your average Wikipedian will see "don't let any bots make changes except everything." Maybe we should call the template "bots" and drop the support for a null parameter to mean deny all bots? Then the code would be {{bots|allow=all}} which looks a bit better to me. What do you think? Hagerman(talk) 17:34, 18 December 2006 (UTC)

This change has already been made. -- RM 13:21, 22 December 2006 (UTC)

How bots uses this template

I just want to clarify how I believe bots uses this template. The bot downloads the wiki source to each page it wants to edit. The bot then checks if the source has this template in the source. If so, it checks the parameters passed to the template. The template does not generate anything on the resulting html page of the pages it is included in. To summarize, the presence of the template include is what makes it work.--Henke37 18:24, 8 May 2007 (UTC)

Sectional?

Is there a sectional form of these tags? I would love to be able to tag just a single section to be ignored, not the entire page. — RevRagnarok Talk Contrib 18:31, 1 April 2007 (UTC)

I too would like a {{nobots begin}} + {{nobots end}} so I can mark the part of a page that bots may not edit.
I am currently working on a Wikipedia help page where I show errors on purpose. But I would still like bots to correct errors in the rest of that page such as fixing redirects, update interwiki links and update categories etc.
Oh, I just realised there is a simple workaround we can use: We can put the part of the page we don't want bots to touch on a separate subpage, then mark that subpage with {{nobots}} and then transclude that subpage into the "main" page. But this will make editing that part of the page harder for inexperienced editors so I will only resort to this workaround if "my" page gets really trashed by the bots. (And I will of course add easy to follow links to that subpage at least from the talk page of the "main" page.)
--David Göthberg (talk) 23:21, 10 March 2008 (UTC)

What does this mean?

"Another option is to opt out of specific types of messages for users that do not wish to be notified of certain problems, but perhaps still other problems." ? --Dweller (talk) 14:08, 24 April 2008 (UTC)

See this section: you can choose to be notified for some types of problems (e.g. images with no source information) and not for others (e.g. prod warnings). Skomorokh 14:21, 24 April 2008 (UTC)
I think the English needs some work, as it doesn't currently make sense. Perhaps I can suggest ..."for users that wish to be notified of certain problems, but not others." --Dweller (talk) 14:29, 24 April 2008 (UTC)
Much clearer, go for it. Skomorokh 14:46, 24 April 2008 (UTC)

Expanded to include opt out of messages

I have just expanded the template to include the capability for users to select to opt out of specific types of messages (or all available types). Bot and script owners are encouraged to implement this feature as well as all of Template:Bots features if they had not previously done so. This will eliminate users needing to know what bots are leaving them messages, and just select not to receive messages in general (at least from bots/scripts). If you have any questions or comments (or a item that should be included on the opt out list (excluding the limitations)), then let me know or post on the talk page. MECUtalk 16:43, 3 April 2008 (UTC)

It needs to be made clearer that editors can only opt out of bot-delivered messages. I've just added a prodwarning to an editor's page and am surprised to see that it offers him the chance to opt out of such messages. But as a person, rather than a bot, I won't know whether he's opted out, AFAIK. PamD (talk) 19:54, 16 April 2008 (UTC)
The opt-out section states 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. Would bolding this in the page help? MECUtalk 21:02, 16 April 2008 (UTC)
No. The problem is that the recipient of the message on their talk page thinks inaccurately that he can avoid getting such messages in future. Actually, he can only avoid getting messages from Bots. This should be made clear at first sight, not subsequently in the process. --Dweller (talk) 14:10, 24 April 2008 (UTC)
I can't help what people think unless they fully read what something does. If you think you can make this more clear and should be made earlier in the page, go ahead and make the changes. I think anyone that reads and assumes how something works without fully investigating or reading the information page is setting themselves up for failure. It's like reading steps 1-5 of a 20 step instruction booklet and then getting upset that you misunderstood how it worked because step 7 explains in detail how it works. But again, go ahead and make changes if you think it's better (aka be bold, I was). I don't claim to be an expert in writing (see below). MECUtalk 18:22, 24 April 2008 (UTC)

interwiki request

{{editprotected}}

Please add interwiki link [[ja:Template:Bots]], thanks. --219.164.57.180 (talk) 21:28, 25 April 2008 (UTC)

 Done αlεxmullεr 11:31, 26 April 2008 (UTC)

feature request: interwikibot opt-out

List of some interwiki bots: SieBot,A4Bot,AlleborgoBot,Thijs!bot,YurikBot,Tsca.bot,Eskimbot – if this is intended as a help to disallow interwikibots, its not much use - there's just too many of them. Instead, interwiki.py should be taught to respect an "interwiki" opt-out switch. (Or, even better, another template that directs it to the right place – usually the problem with interwiki bots is that they make a mess of pages which have iw-links transcluded from another page, eg. a template documentation subpage.) --Tgr (talk) 13:15, 25 April 2008 (UTC)

I belatedly second this... see Prestonia, Louisville a very minor article but buts are always incorrectly adding a language link to it. I didn't intend to disallow all bots to edit that page, but I couldn't figure out another way. --Rividian (talk) 01:20, 5 August 2008 (UTC)
I too second this. Just reverted the 3rd incorrect bot generated iw link on Kings Langley. I think I've sorted it by editing the linked pages on nl and ro, but who knows if it'll work, the Dutch wiki's got a different save page mechanism. If the languages were less 'guessable' this wouldn't have been possible. This interwikibot opt-out would prevent this grief, and cater for the situation where the other language is totally incomprehensible to the editor.
Rividian, I've corrected the link on pt:Prestonia to point to Prestonia (plant) for you. Hope that sorts your problem. Bazj (talk) 08:00, 13 August 2008 (UTC)

Adding CSDwarnbot

According to the documentation, it's as simple as adding : <!--User:CSDWarnBot--> to the page. Why not add this to the nobots part of the template??? ηoian ‡orever ηew ‡rontiers 03:16, 21 January 2009 (UTC)

You'd have to talk to ST47, the operator of CSDwarnbot, about adding detection of this template to the bot. This template is really just the same thing as CSDwarnbot looking for that special comment, except that it's slightly more standardized. Anomie 03:51, 21 January 2009 (UTC)
I meant, why not add the comment to the contents of this template, but I left a message on ST47's talk page the same. ηoian ‡orever ηew ‡rontiers 05:56, 21 January 2009 (UTC)
Unless CSDwarnbot loads all templates on the page looking for its comment (which is unlikely) or this template were substed (which would break its normal use), that wouldn't work. Anomie 11:48, 21 January 2009 (UTC)

BetacommandBot

Can someone tell me why User:BetacommandBot was able to make this edit to my talkpage even though I had both {{bots|deny=BetacommandBot}} and {{nobots}} on the page? Skomorokh incite 21:39, 15 December 2007 (UTC)

Sorry for the late reply. If it is still of any interest to you, it is because BetacommandBot is not exclusion compliant. Any bot which is not in this category will ignore this template. Puchiko (Talk-email) 23:42, 2 February 2008 (UTC)
Moreover, you can't opt out of automated warnings, per Template:Bots#Restrictions_of_messages_that_can_be_opted_out. Superm401 - Talk 08:32, 15 April 2008 (UTC)
The restrictions were added after this comment. I'm not aware of any bot or script that is fully compliant with all of Template:Bots. MECUtalk 12:27, 15 April 2008 (UTC)
Hm well, Smackbot just ignores any page with bots or nobots templates, has since they were created. Even if it said {{bots|allow=SmackBot}}. Perhaps I should change to using the AWB functionality alone, it is probably smarter. Rich Farmbrough, 15:19, 6 September 2009 (UTC).

What, exactly, is "blunt instrument"?

"Avoid using the template as a blunt instrument" — Does this mean I should avoid tagging an article {{nobots}} while working? I tend to work in a list-like order, and this means sometimes there will be orphaned citations and similar things for several minutes while I'm working on something else. I've had problems in the past where a bot will disturb the article edit trying to fix something that's purposely left in error, simply because it's an "I'll be getting to it later" situation. I can't have bots on my mind while I'm reading through articles and trying to make edits. So, is using this tag for this purpose (and temporarily) considered "blunt instrument"? - Kerαunoςcopiagalaxies 19:15, 12 June 2010 (UTC)

That seems fine to me, as long as you remove it when you are done. –xenotalk 19:37, 12 June 2010 (UTC)
Okay, great, thank you. I would only use it in extreme cases, but I was hoping to clarify the blunt instrument part if I were to use the template. And definitely, it would be temporary. – Kerαunoςcopiagalaxies 20:06, 12 June 2010 (UTC)
Depending on the bot, you may also be able to use {{in use}} which will also warn human editors that you're in the middle of a major edit. For example, AnomieBOT, who you may be referring to regarding orphaned citations, does honor that template when fixing orphaned references. Anomie 23:58, 12 June 2010 (UTC)
Great suggestion, and I didn't realize AnomieBot recognized it. I've used {{in use}} in the past on lower-traffic articles, but I wanted to avoid tagging this article; I wasn't too concerned about human interference. But this is good to know (about the bot) for the future, thank you. – Kerαunoςcopiagalaxies 00:35, 13 June 2010 (UTC)
AWB also avoids {{inuse}} although it can be told not to. Rich Farmbrough, 23:49, 22 September 2010 (UTC).

USAGE

Currently there are approximately:

  • 1k user/user talk uses
  • 900 other uses
  • 100 articles uses/transclusions

I have cleaned up a bunch of old ones, and will revisit, USER space is fine but it should only be used as a sticking plaster on project space, per the above section, until either the article is brought into line with the ideal or the bot or bots are improved to avoid that particular change. Any help reducing the number of uses is appreciated. Rich Farmbrough, 23:49, 22 September 2010 (UTC).

python improvement

Light python version improvement: if (re.search(r'(?im)\{\{\s*(nobots|bots\|(allow=none|deny=.*?' + user + r'.*?|optout=all|deny=all))\s*\}\}', text)):

For spaces between {{ }} and the template name. Is it OK? emijrp (talk) 17:43, 21 April 2011 (UTC)

spaces

Would I add {{bots|allow=SineBot,ClueBot,ClueBot NG}} without any space after the comma or {{bots|allow=SineBot, ClueBot, ClueBot NG}} with a space after the comma? Crazymonkey1123 (Jacob) T or M/Sign mine 16:49, 8 May 2011 (UTC)

Follow Postel's Law: You should not include spaces around the bot names, although a compliant bot should exclude itself even if you do. Anomie 00:00, 11 May 2011 (UTC)

MiszaBot?

On Talk:Climatic Research Unit email controversy, something about

{{bots|allow=HBC Archive Indexerbot,MiszaBot I}}

was stopping the MiszaBot archiver from acting since it was added in May. (The indexerbot has run.) I tried fiddling with it, without figuring out what was wrong. Any suggestions?
—WWoods (talk) 17:10, 5 July 2011 (UTC)

Auto editing and the curtailing of freedom of speech

What ever happened to the idea that Wikipedia was free for all to work with, create and edit pages etc? More and more we ordinary users are being blocked and 'reverted' by automatic editors just like this one, either that or by people who consider themselves more equal than the rest of us. Wikipedia might just as well call itself the Encyclopaedia Britannia mark 2.0 i.e. free to no one!90.193.238.129 (talk) 21:09, 19 August 2011 (UTC)

Wrong link

The link in the end of the "Syntax" section goes to an empty category. It should go to Category:Wikipedia bots which are exclusion compliant instead. -- Aspiriniks (talk) 09:45, 29 September 2011 (UTC)

 Fixed. Note that almost all templates with the "blue box" style of documentation have that documentation on a subpage so the documentation can be edited by any user; look for the "edit" link at the top of the blue box. Anomie 10:35, 29 September 2011 (UTC)

Subpages

Does this template still work if placed on a subpage of my user talk? That is, will it still block bot messages on my talk page if it's transcluded from a subpage of my talk page? -- œ 10:42, 20 December 2011 (UTC)

There may be some bots that would be blocked in that way, but in general no. This isn't really a template so much as a bit of text for the bot to look for in the page's wikitext. Anomie 12:18, 20 December 2011 (UTC)

There should only be one, right?

The docs don't explicitly mentioned whether there should be at most one occurrence of {{Bots}} on a page, or if several are allowed. Bots that look for a match with regexes will probably handle this with no problem, yet bots that parse the page and its templates have to make a choice. Consider,

{{Bots |deny=bot1}}
{{Bots |deny=bot2}}

According to the documentation, a bot that is not in the |deny= list is allowed. Should bot2 interpret this as (i) bot2 is allowed, because not explicitly denied by the first occurrence, or (ii) bot2 is denied? I think it's pretty clear that the user wants the second interpretation, but this case doesn't match the template documentation. A bot that parses the page needs to interpret the first {{Bots}} differently depending on whether there are other occurrences.

The simplest resolution might be to say that only one occurrence is allowed. Blevintron (talk) 14:22, 28 April 2012 (UTC)

Feature request: Bot functionality opt-out

Lots of bots perform a whole range of functions, and lots of functions are performed by many bots alike. I guess many entries on the Nobots Hall of Shame are there because of just one unwanted function. This is too blunt an instrument, so I propose to give functions performed by more than one bot a canonical name to be used as an argument in this template. I'd expect bot programmers to be anxious to get their bots off the HoS list by allowing a bit of fine-tuning. --Mkratz (talk) 21:28, 18 July 2013 (UTC)

Whether this needs to be a "real" template call

I regularly use the "{{nobots}}" template on my user pages at wikis that don't "have" the template, to try cut down on "useless" edits by bots. To prevent a redlink from showing up on the page, I wrap the call in a '<span style="display:none">' element. Unfortunately, this results in the template showing up at Special:WantedTemplates on those wikis. Some admins don't like this, so they remove the template call from my user page.

Based on the example code shown on this page, it seems that many bots will just check for the literal text "{{bots…" or "{{nobots…" on the page, while some bots will use a "real" parser ("mwparserfromhell") that looks for "real" template calls. I assume this means that the following two forms will not be recognized by the latter type of bot:

  • <!-- {{nobots}} -->
  • <span style="display:none"><nowiki>{{nobots}}</nowiki></span>

Right?

(BTW: whether what I'm doing is effective in the first place is another matter entirely, since it seems likely that a bot preparing to make an unwanted edit to a user page will likely not respect a "nobots" directive, anyway. But whatever.) - dcljr (talk) 05:08, 19 September 2013 (UTC)

I believe most bots (and parsers) are not smart enough to know an active template call from an inactive template call. Wrapping the template in an HTML comment or in nowiki tags should work fine. --MZMcBride (talk) 18:22, 27 September 2013 (UTC)
Unfortunately Pywikibot scripts are smart enough to ignore HTML comments and nowiki tags... Legoktm (talk) 23:32, 27 September 2013 (UTC)
Thought so. Thanks for the confirmation. - dcljr (talk) 06:33, 11 October 2013 (UTC)

Some things missed by the sample code segments

Extended content
        /// <summary>
        /// This function will remove commented uses of the {{nobots}} or {{bots}} template so that they are 
        /// not considered in the BotEditPermitted() function.
        /// </summary>
        /// <param name="PageText"></param>
        /// <param name="CommentStart"></param>
        /// <param name="CommentEnd"></param>
        /// <returns></returns>
        private static String RemoveComment(String PageText, String CommentStart, String CommentEnd)
        {
            // Remove anything that is inside of <nowiki> ... <nowiki> or <!-- ... -->
            for (int nowiki = PageText.IndexOf(CommentStart, StringComparison.CurrentCultureIgnoreCase); 0 <= nowiki; nowiki = PageText.IndexOf(CommentStart, StringComparison.CurrentCultureIgnoreCase))
            {
                int endnowiki = PageText.IndexOf(CommentEnd, nowiki, StringComparison.CurrentCultureIgnoreCase);

                if (0 <= endnowiki)
                {
                    String NewText = "";
                    if (0 < nowiki)
                    {
                        NewText = PageText.Substring(0, nowiki);
                    }

                    if (endnowiki + CommentEnd.Length < PageText.Length)
                    {
                        NewText += PageText.Substring(endnowiki + CommentEnd.Length);
                    }

                    PageText = NewText;
                }
                else
                {
                    // If the comment doesn't end, then we're done
                    return PageText;
                }
            }

            return PageText;
        }

        /// <summary>
        /// This function attempts to parse the page text for the {{bots}} and {{nobots}} templates.
        /// 
        /// {{nobots}} will be checked for allow=BotUserName or optin=BotNotificationType
        /// {{nobots}} can also be superseded by a {{bots|allow=BotUserName}} or {{bots|optin=BotNotificationType}}
        /// 
        /// {{bots|allow=Bot1,Bot2}} is interpreted as disallowing everything but Bot1 and Bot2 unless another {{bots}} statement is found
        /// </summary>
        /// <param name="PageText">The page text to be parsed.</param>
        /// <param name="BotUserName">This bot's username, this function will check for it in "allow" or "deny".  IMPORTANT: </param>
        /// <param name="BotNotificationType">The type of notification this bot is sending, e.g. nosource, nolicense, orfud.</param>
        /// <returns>Returns true if this bot is permitted to edit the page and false if it is not.</returns>
        public static bool BotEditPermitted(string PageText, string BotUserName, string BotNotificationType)
        {
            try
            {
                // Remove comments from consideration
                PageText = RemoveComment(PageText, "<nowiki>", "</nowiki>");
                PageText = RemoveComment(PageText, "<!--", "-->");

                // Find all of the bots or nobots tags
                MatchCollection matches = Regex.Matches(PageText, @"\{\{\s*(nobots|bots|deceased wikipedian)[^\}\{]*\}\}", RegexOptions.IgnoreCase);

                if (null != matches && matches.Count > 0)
                {
                    List<string> commands = new List<string>();

                    foreach (Match m in matches)
                    {
                        if (0 < m.Length)
                        {
                            // This is an individual bots tag to process
                            commands.Add(PageText.Substring(m.Index, m.Length).Trim());
                        }
                    }
                
                    // Rule #1: if any command denies this bot by name, then disallow the edit
                    if (!String.IsNullOrWhiteSpace(BotUserName))
                    {
                        foreach (String str in commands)
                        {
                            if (Regex.IsMatch(str, @"\{\{\s*(nobots|bots).*deny\s*\=\s*([^\|]*\,|)\s*" + Regex.Escape(BotUserName) + @"\s*(\,[^\|]*|)(\|.*|)\s*\}\}", RegexOptions.IgnoreCase))
                            {
                                return false;
                            }
                        }
                    }

                    // Rule #2 - if any command opts out of this notification type by name, then disallow the edit
                    if (!String.IsNullOrWhiteSpace(BotNotificationType))
                    {
                        foreach (String str in commands)
                        {
                            if (Regex.IsMatch(str, @"\{\{\s*(nobots|bots).*optout\s*\=\s*([^\|]*\,|)\s*" + Regex.Escape(BotNotificationType) + @"\s*(\,[^\|]*|)(\|.*|)\s*\}\}", RegexOptions.IgnoreCase))
                            {
                                return false;
                            }
                        }
                    }

                    // Rule #3 - if any command allows this bot by name, then allow the edit
                    if (!String.IsNullOrWhiteSpace(BotUserName))
                    {
                        foreach (String str in commands)
                        {
                            if (Regex.IsMatch(str, @"\{\{\s*(nobots|bots).*allow\s*\=\s*([^\|]*\,|)\s*" + Regex.Escape(BotUserName) + @"\s*(\,[^\|]*|)(\|.*|)\s*\}\}", RegexOptions.IgnoreCase))
                            {
                                return true;
                            }
                        }
                    }

                    // Rule #4 - if any command opts in to this notification type by name, then allow the edit
                    if (!String.IsNullOrWhiteSpace(BotNotificationType))
                    {
                        foreach (String str in commands)
                        {
                            if (Regex.IsMatch(str, @"\{\{\s*(nobots|bots).*optin\s*\=\s*([^\|]*\,|)\s*" + Regex.Escape(BotNotificationType) + @"\s*(\,[^\|]*|)(\|.*|)\s*\}\}", RegexOptions.IgnoreCase))
                            {
                                return true;
                            }
                        }
                    }

                    // Rule #5 - if we have a {{bots|allow=all}} or {{nobots|allow=all}}, then allow the edit (does anyone do this?)
                    foreach (String str in commands)
                    {
                        if (Regex.IsMatch(str, @"\{\{\s*(nobots|bots).*allow\s*\=\s*([^\|]*\,|)\s*all\s*(\,[^\|]*|)(\|.*|)\s*\}\}", RegexOptions.IgnoreCase))
                        {
                            return true;
                        }
                    }

                    // Rule #6 - if we have a {{(no)bots|allow=none}} or {{(no)bots|deny=all}}, then disallow the edit
                    foreach (String str in commands)
                    {
                        if (Regex.IsMatch(str, @"\{\{\s*(nobots|bots).*(allow\s*\=\s*([^\|]*\,|)\s*none|deny\s*\=\s*([^\|]*\,|)\s*all)\s*(\,[^\|]*|)(\|.*|)\s*\}\}", RegexOptions.IgnoreCase))
                        {
                            return false;
                        }
                    }

                    // Rule #7 - if we have a {{nobots}} of any sort or a {{deceased wikipedian}} and we haven't found one of the exemptions above, then disallow the edit
                    foreach (String str in commands)
                    {
                        if (Regex.IsMatch(str, @"\{\{\s*(nobots|deceased wikipedian).*\}\}", RegexOptions.IgnoreCase))
                        {
                            return false;
                        }
                    }

                    // Rule #8 - if we have a {{bots|allow=anything}} and we are not mentioned by name, then disallow the edit
                    foreach (String str in commands)
                    {
                        if (Regex.IsMatch(str, @"\{\{\s*(nobots|bots).*allow\s*\=\s*.*\}\}", RegexOptions.IgnoreCase))
                        {
                            return false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return true;
        }

@Stefan2 and Magioladitis: I think this is probably a discussion worth bringing here that has been occurring a couple of places. There are several problems we have observed with the code samples. (1) They do not support indirect transclusions from other templates. This is highly impractical to support, and I'm sure it's not going to happen any time soon, but very notably the {{deceased Wikipedian}} template attempts to transclude {{nobots}}. Out of respect, I think that {{deceased Wikipedian}} should be treated like a {{nobots}} template. (2) They don't handle the possibility that the template might be inside of a nowiki segment or an html comment. It is not especially uncommon to find someone use nowiki blocks around the bots or nobots template on a talk page and they obviously don't intend for those templates to have an effect. (3) Many of the code segments are not going to support {{bots}}. (4) None of them will have consistent behavior if you have multiple bots templates on the page. (5) Few of them properly support the allow tag as it is defined in the spec. If you have {{bots}} and you're not one of those bots, then you're supposed to be disallowed. I have come up with C# code that handles all of these things cases. It's long. I have pasted it above. It would be great if someone who is far more of a regex guru than I could collapse this all into one giant regex that would properly handle the order of precedence I have laid out. --B (talk) 03:20, 27 April 2015 (UTC)

  • Some notes:
Many bot authors do not write their own implementations of {{bots}} and {{nobots}} but depend on other tools which already implement the templates, for example AWB and Pywikipedia. It therefore makes sense to look at what these tools do. Pywikipedia uses a very complex implementation, and it looks as if Pywikipedia ignores any templates within "nowiki" and <!-- -->.
Templates may use complex layout:
{{bots
|this is an invalid parameter = ignore this parameter
|allow                        = Bot 1
|deny                         = Bot 2
}}
Some bot implementations do not support multi-line implementations and implementations containing invalid parameter names. It looks as if Pywikipedia's very complex implementation might support this, but I haven't tested this.
If a page contains {{bots}} or {{nobots}} by virtue of transclusion of a template, such as {{deceased Wikipedian}}, then the bot could ask the API if the page contains {{bots}} or {{nobots}}, but there doesn't seem to be a way to tell if the template uses any parameters.
No implementation at Template:Bots/doc#Example implementations looks for redirects for {{bots}}, but some implementations are case-insensitive. This means that some implementations support the redirect {{NOBOTS}} while other implementations don't.
Some example implementations have problems if you use {{bots|deny=Bot 2|allow=Bot 1}} instead of {{bots|allow=Bot 1|deny=Bot 2}}. Standard Mediawiki syntax allows you to specify template parameters in any order. --Stefan2 (talk) 10:04, 27 April 2015 (UTC)
  • User:B: Mediawiki allows you to use HTML entities in template names, for example {{&#x62;&#x6f;&#x74;&#x73;}}. Your example code misses this. --Stefan2 (talk) 12:14, 27 April 2015 (UTC)
    • Why would anyone do that? --B (talk) 12:21, 27 April 2015 (UTC)
      • Don't know. I noticed this when looking at Pywikipedia's source code. Pywikipedia uses some functions which also are used for other purposes, and one of the functions decodes HTML entities and urlencoded template names. Probably unimportant to support in a bot. --Stefan2 (talk) 21:56, 27 April 2015 (UTC)
        • @Stefan2: Would it be at all within the realm of possibilities to have an API function that bots could call? Do we have the ability to add enwiki-specific API functions somehow? That's probably the best-case scenario - to somehow have an API function that anyone - no matter what language the bot is written in - could call. That way, there is a completely consistent behavior and you don't have to guess whether some bot might not obey your tag because your parameters are in the wrong order or because it's a Tuesday. --B (talk) 23:08, 27 April 2015 (UTC)
          • I have no idea how to add API functions, but presumably you would have to modify Mediawiki. I don't think that enwiki-specific API functions would be a good idea. The "bots" and "nobots" templates are used on other projects too, and to make it simple for bot authors, the templates should work in the same way on all projects. By the way, it seems that the framework you are using already contains an implementation of "bots" and "nobots", but the implementation seems to be missing some features. --Stefan2 (talk) 23:55, 27 April 2015 (UTC)
          • Within the realm of possibility, yes, by making a custom extension of some sort. Probably not a great idea though.

            Truth is that this template isn't all that well designed (e.g. no consideration for multiple instances, conflicting instructions, bots with names containing commas, etc.), and we could do better especially now that we have Scribunto (I'd probably go for hidden urn links that bots could check with prop=extlinks, like Template:Edit protected uses). The problem would be all the existing code that uses things as they are now. Anomie 14:55, 28 April 2015 (UTC)

            I agree with you User:Anomie. While bot frameworks need to support the old implementation as it has been copied to wikis the world over, lets build a better implementation that the world can copy tomorrow (and we'll hate in 9 years time) Where was the URN approach implemented in Lua code? John Vandenberg (chat) 05:53, 6 June 2015 (UTC)

Respect nobots

Please respect the nobots template. I've no patience for spam. Can we ban bots that ignore it? — Preceding unsigned comment added by ‎84.93.60.82 (talk)

Which bots are not respecting it? — Earwig talk 01:08, 24 November 2015 (UTC)
This might have to do with the thread under this one, which is relevant to massmessage not opting-out users with {{nobots}} templates.  · Salvidrim! ·  14:37, 24 November 2015 (UTC)

Massmessage opt-out

(copied/moved from Wikipedia talk:Arbitration Committee Elections December 2015#Spam)

Maybe [[:Category:Opted-out of message delivery]] should be added to {{nobots}}? Catnip the Elder (talk) 03:30, 24 November 2015 (UTC)

Regardless of the proposer, I think this is a valid suggestion. I'll copy it to Template talk:No bots.  · Salvidrim! ·  14:37, 24 November 2015 (UTC)
Given the context: definitely support doing that. Community feeling was clear that supporting nobots for the Arbcom election message was important. --Errant (chat!) 19:37, 24 November 2015 (UTC)
Considering that the MassMessage extension isn't actually a bot, I'm not sure how appropriate that really is. Further, it would likely require unredirecting Template:Nobots and adding logic to detect whether it was placed on a user talk page or not. Anomie 21:07, 24 November 2015 (UTC)
It's marked as a bit edit. --Errant (chat!) 00:00, 25 November 2015 (UTC)
Maybe at least it could be made clear and highlighted in the documentation that nobots doesn't impact the massmessage extension and that you should instead add this category.  · Salvidrim! ·  22:15, 24 November 2015 (UTC)
I think that's an excellent suggestion to implement in the meantime. clpo13(talk) 23:56, 24 November 2015 (UTC)
Special:Diff/692333716. — Earwig talk 00:09, 25 November 2015 (UTC)
Yes, agree, do. --Monochrome_Monitor 04:13, 25 November 2015 (UTC)
Probably not a good idea, as MassMessage is also used to deliver messages users have explicitly subscribed to. Making this change would also prevent those messages from being delivered. A more viable solution may be to ask people sending non-targeted messages to take the template into consideration when compiling delivery lists. wctaiwan (talk) 22:26, 9 December 2015 (UTC)

Double line break

Yobot replaced this line:

<br><br><!-- Please do not remove this double line break-->

with this:

<!-- Please do not remove this double line break-->

here. Is there a way to stop it from doing this or an alternative way to maintain a double line break? What I really need is to vertically align the four columns produced by {{col-4}}? — Kpalion(talk) 16:21, 31 January 2016 (UTC)

Seemingly inaccurate code examples

Some of the code examples like the python one seem to say that bots should not edit articles with just {{bots}} but the template seems to claim that this means they can be edited.

I agree, the last line of the Python code should be return True. − Pintoch (talk) 21:03, 26 October 2016 (UTC)
I don't think your correction is any more correct. It looks like the old code would treat {{bots}} like {{nobots}}. Your "fix" makes it treat {{nobots}} like {{bots}} instead, which is probably more likely to be problematic. Anomie 01:56, 27 October 2016 (UTC)

Tavix and I were discussing the editing of WP:RFD. Somehow, there was trouble making the template work to prevent dumbBOT from editing the page. Therefore, I wonder whether someone here can create a better tool at the Template:Bots/sandbox page. --George Ho (talk) 03:17, 5 February 2017 (UTC)

This template doesn't actually do anything to exclude a bot, it's up to each individual bot to look for it in the page content. DumbBOT may not do so, and if it doesn't then no change to this template is likely to change that. Anomie 16:35, 5 February 2017 (UTC)

Tracking category

Just wondering whether it makes sense for this template to have a hidden tracking category. Apparently there was one briefly but it was removed with the justification "unnecessary, can get this more directly" which isn't obvious at all. Jo-Jo Eumerus (talk, contributions) 16:51, 5 April 2017 (UTC)

You could just use WhatLinksHere. Or you could look at User:AnomieBOT/Nobots Hall of Shame. Anomie 20:42, 5 April 2017 (UTC)
Well, none of them display at the bottom of the page they are used on, and the first is mostly random. Not sure if that would be a benefit, although and extra cat may not hurt. Jo-Jo Eumerus (talk, contributions) 15:10, 6 April 2017 (UTC)
Why should it display at the bottom of the page? And a category would probably mislead people into thinking that transcluding a template that transcludes {{bots}} would somehow actually work, which it doesn't. Anomie 19:41, 6 April 2017 (UTC)
Huh, was not thinking in these terms. Jo-Jo Eumerus (talk, contributions) 19:54, 6 April 2017 (UTC)

Template-protected edit request on 9 February 2019

Please add the following line to this template (or copy the sandbox, which has the line):

{{#if:{{{optout|}}}|{{#invoke:Bots|check_mass_message|{{{optout}}}}}}}

This calls on Module:Bots. What it does is, if the optout parameter includes "MassMessage", the page which has the template is added to Category:Wikipedians who opt out of message delivery. See the testcases page (remove the invocations of the sandbox, and you'll see that the page is no longer in the category; add them back, and it is). This should have no affect on the functioning of the template with regard to other parameters.

Thanks, --DannyS712 (talk) 21:43, 9 February 2019 (UTC)

 Done -- /Alex/21 07:33, 10 February 2019 (UTC)

Spec or test suite

I think it would be useful for either a spec (e.g. a syntax which is simpler than the full wikicode 'syntax') and/or a test suite to be created, somewhere, that includes usages that are supported, and where possible it should be simple for a bot to use the spec or test suite to verify conformance. We could then test each bot client and mark which tests they do not yet support.

For example, one rule I would like to suggest is the template must not be appear within parserfunctions or other templates, or some other similar restriction that ensures it can provably not be affected by phabricator:T101596. John Vandenberg (chat) 05:34, 6 June 2015 (UTC)

If database tables are out of date (for example, because the page uses {{#ifeq:{{CURRENTYEAR}}|2015|{{nobots}}}} and it becomes a new year), then bots would be required to purge all pages with the forcelinkupdate parameter before checking if they are allowed to edit, wouldn't they? How would this affect performance? --Stefan2 (talk) 12:52, 14 June 2015 (UTC)
Yes, that is an example of the the problems I am trying to avoid by having a specification. We can obtain a greater percentage of tools supporting most of the syntax if it is sane. If someone wants to set a date range, a more suitable approach would be to add a date= parameter with the date in a commonly accepted machine readable format, and wikitext around the template isnt the right choice for widespread adoption. John Vandenberg (chat) 08:17, 17 June 2015 (UTC)
[true, '{{nobots}} bla'],
[true, '{{bots|deny=Bob,CodexBot}} bla', 'CodexBot'],
[false, '<!-- {{bots|deny=Bob,CodexBot}} --> bla', 'CodexBot'],
[false, '{{bots|deny=Bob,FuBot}} bla', 'CodexBot'],

Mine. Irønie (talk) 14:43, 28 September 2020 (UTC)