Permalink
Browse files

Notify the uploader

  • Loading branch information...
1 parent 39f9366 commit 61e84f02ac25ff8e8eccf700bd129d6c7311240f @theopolisme committed Jul 17, 2013
Showing with 14 additions and 1 deletion.
  1. +14 −1 selfimages.py
View
@@ -92,9 +92,22 @@ def process_page(page):
global donenow
if bot.donenow("User:Theo's Little Bot/disable/selfimages",donenow=donenow,donenow_div=5,shutdown=50) == True:
+ # adding the template
page.save(contents,"[[WP:BOT|Bot]]: Automatically adding {{[[Template:Information|Information]]}} to self-published work) ([[User:Theo's Little Bot/disable/selfimages|disable]]")
- print "saved {0}".format(page.page_title)
+ print "Saved [[File:{0}]]".format(page.page_title)
donenow += 1
+ # notifying the uploader
+ usertalktitle = "User talk:"+user
+ if bot.nobots(usertalktitle,user="Theo's Litle Bot",task='selfimages') == True:
+ usertalk = site.Pages[usertalktitle]
+ original_talk = usertalk.edit()
+ if original_talk.find('<!--Template:Un-botfill-->') == -1:
+ talkcontents = original_talk + "\n\n== Notification of automated file description generation ==\n{{subst:Un-botfill|file="+page.page_title+"|sig=~~~~}}"
+ else:
+ print "sub!!!"
+ talkcontents = re.sub(r"""Template:Un-botfill-->(.*?)(?:\n|\r|\Z)""","""Template:Un-botfill-null-->\g<1>\n*{{subst:Un-botfill/followup|file="""+page.page_title+"|sig=~~~~}}",original_talk,flags=re.UNICODE)
+ usertalk.save(talkcontents,"[[WP:BOT|Bot]]: Notifying user about autogenerated {{[[Template:Information|Information]]}} addition) ([[User:Theo's Little Bot/disable/selfimages|disable]]")
+ print "Saved [[User talk:{0}]]".format(usertalk.page_title)
else:
sys.exit()

0 comments on commit 61e84f0

Please sign in to comment.