Planning the future of Botwiki! - Help us bring Botwiki up to date, contribute to our strategy discussion, add bot scripts, and contribute manuals, guides, and tutorials! Almost anything related to bots, particularly those used to edit mediawiki, is welcome.
UNABLE TO EDIT? - We've experienced attacks by spambots lately and now require you to confirm your e-mail before you can edit (go to your preferences, enter an e-mail address, and request a confirmation e-mail, then go to your e-mail and click on the confirmation link). We also require new accounts to make a few edits and wait a few minutes before before you can create a page; however, if this is a problem contact us in #botwiki and we can manually confirm your account. Sorry for the inconvenience.
Python:White cat.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Bot for White Cat to add redirect to his bot's user talk. """ # # (C) Filnik, 2007 # # Distributed under the terms of the MIT license. # __version__ = '$Id: $' # import wikipedia def main(): usernames = dict() usernames[('meta','meta')] = u'Computer' usernames[('commons','commons')] = u'Computer' usernames[('wikipedia','ar')] = u'حاسوب' usernames[('wikipedia','az')] = u'Kompyuter' usernames[('wikipedia','cs')] = u'Počítač' usernames[('wikipedia','de')] = u'Computer' usernames[('wikipedia','en')] = u'Computer' usernames[('wikipedia','es')] = u'Computadora' usernames[('wikipedia','et')] = u'Arvuti' usernames[('wikipedia','fr')] = u'Ordinateur' usernames[('wikipedia','is')] = u'Tölva' usernames[('wikipedia','ja')] = u'電算機' usernames[('wikipedia','ku')] = u'Komputer' usernames[('wikipedia','nn')] = u'Datamaskin' usernames[('wikipedia','no')] = u'Datamaskin' usernames[('wikipedia','ru')] = u'Компьютер' usernames[('wikipedia','sr')] = u'Рачунар' usernames[('wikipedia','tr')] = u'Bilgisayar' usernames[('wikipedia','uz')] = u'Kompyuter' usernames[('wikipedia','simple')] = u'Computer' usernames[('wikinews','ar')] = u'حاسوب' usernames[('wikinews','bs')] = u'Računar' usernames[('wikinews','ca')] = u'Ordinador' usernames[('wikinews','de')] = u'WOPR' usernames[('wikinews','es')] = u'Computadora' usernames[('wikinews','fi')] = u'Tietokone' usernames[('wikinews','fr')] = u'Ordinateur' usernames[('wikinews','he')] = u'מחשב' usernames[('wikinews','it')] = u'Computer' usernames[('wikinews','ja')] = u'電算機' usernames[('wikinews','nl')] = u'Computer' usernames[('wikinews','no')] = u'Datamaskin' usernames[('wikinews','pl')] = u'Komputer' usernames[('wikinews','pt')] = u'Computador' usernames[('wikinews','ro')] = u'Computer' usernames[('wikinews','ru')] = u'Компьютер' usernames[('wikinews','sr')] = u'Рачунар' usernames[('wikinews','sv')] = u'Dator' usernames[('wikinews','uk')] = u'Комп\'ютер' usernames[('wikinews','zh')] = u'計算機' always = False for arg in wikipedia.handleArgs(): if arg == '-always': always = True summary = 'Bot: Adding redirect to my user talk' for site in usernames.keys(): nickname = usernames[site] wikipedia.output('Processing:%s with username:%s' % (site, nickname)) wiki_site = wikipedia.getSite(site[1], site[0]) # Seems that the project and the lang are not the same as in our list user_talk = wikipedia.Page(wiki_site, 'User_talk:%s' % nickname) try: text = user_talk.get() except wikipedia.NoPage: wikipedia.output(u"Page empty, let's create it") text = '' except wikipedia.IsRedirectPage: wikipedia.output(u'Already a redirect, skip...') continue newtext = "#REDIRECT [[User talk:White Cat]]" if text != newtext: wikipedia.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<" % user_talk.title()) wikipedia.showDiff(text, newtext) choice = '' # Let's put the changes. while 1: # If someone load it as module, maybe it's not so useful to put the text in the page if not always: choice = wikipedia.inputChoice(u'Do you want to accept these changes?', ['Yes', 'No', 'All'], ['y', 'N', 'a'], 'N') if choice.lower() in ['a', 'all']: always = True if choice.lower() in ['n', 'no']: continue if choice.lower() in ['y', 'yes'] or always: try: user_talk.put(newtext, summary) except wikipedia.EditConflict: wikipedia.output(u'Edit conflict! skip!') break except wikipedia.ServerError: errorCount += 1 if errorCount < 5: wikipedia.output(u'Server Error! Wait..') time.sleep(3) continue else: raise wikipedia.ServerError(u'Fifth Server Error!') except wikipedia.SpamfilterError, e: wikipedia.output(u'Cannot change %s because of blacklist entry %s' % (page.title(), e.url)) break except wikipedia.PageNotSaved, error: wikipedia.output(u'Error putting page: %s' % error.args) break except wikipedia.LockedPage: wikipedia.output(u'Skipping %s (locked page)' % page.title()) break else: # Break only if the errors are one after the other... errorCount = 0 break if __name__ == "__main__": try: main() finally: wikipedia.stopme()