Wikipedia:Bots/Requests for approval/AzaBot
- The following discussion is an archived debate. Please do not modify it. Subsequent comments should be made in a new section. The result of the discussion was Speedily Approved.
Operator: AzaToth
Automatic or Manually Assisted: manually
Programming Language(s): python (pywikipedia) / perl
Function Summary: Spamming
Edit period(s) (e.g. Continuous, daily, one time run): once a week
Edit rate requested: it's around 40-50 to spam, so the time isn't that relevant
Already has a bot flag (Y/N): N
Function Details: As I already had a bot, and it was aprooved by the old system, I forgot to go through the official channels, I'll do it now. The purpose is basically once a week, when rolling the Wikipedia:ACID, I need to notify the voters that the article has been chosen, and that's usually around 50 people, resulting in too much work to do it manually, I then created a script in python to do the work for me (in pywikipedia framework), consisting of following code:
#!/usr/bin/python # -*- coding: utf-8 -*- msg = '{{subst:AIDvoter}} ~~~~' import spam_users import wikipedia import os,sys site = wikipedia.getSite() for s in spam_users.users: page = wikipedia.Page(site,s) if page.isRedirectPage(): page = page.getRedirectTarget(); if page.title() in users: # dual entry continue; elif page.isCategory() or page.isImage(): continue oldtext = '' if page.exists(): oldtext = page.get() newtext = oldtext + "\n" + msg wikipedia.showDiff(oldtext, newtext) wikipedia.setAction('You helped choose this week\'s [[WP:ACID]] winner') page.put(newtext)
the script will read an array from the file spam_users that are created by following perl script:
#!/usr/bin/perl -w use strict; use Array::Uniq; use File::Slurp; my $var = read_file('spam_data'); write_file('spam_users.py',"users = [\n\t".join(",\n\t",uniq sort map{$_=~s/\'/\\\'/g;$_='\'User talk:'.ucfirst((split /:\s*/,$_,2)[1]).'\''}grep(!/\//,($var=~/\[\[(User:.*?)(?:\||\]\])/g)))."\n]\n"); print"Remember to check spam_users.py for correctness before running ./spam.py\n";
who will read from a "spam_data" file which contains the wikitext list from the nomination page.
Sorry for the "running a rouge bot", but things can slip the mind :) →AzaToth 04:00, 20 December 2006 (UTC)[reply]
Discussion
[edit]Speedily Approved. This is a proven bot from a proven user. There is no reason not to give this official approval. If you could, please make the bot compliant with Template:bots so that users can easily opt-out if they choose to do so. It seems apparent that those voting users have implicitly opted-in in this case, but you should respect their wishes if they use this new system now or in the future. Also, since other users use phython frequently, any published code that does the opt-in/opt-out check would be appreciated. -- RM 13:15, 20 December 2006 (UTC)[reply]
- Ok, I have made an patch for pywikipedia tp handle that, located at http://www.pastey.net/3817 →AzaToth 15:47, 20 December 2006 (UTC)[reply]
- The above discussion is preserved as an archive of the debate. Please do not modify it. Subsequent comments should be made in a new section.