|
|
@ -30,7 +30,7 @@ import pywikibot |
|
|
|
import jogobot |
|
|
|
|
|
|
|
|
|
|
|
class MissingNoticeBot(): |
|
|
|
class MissingNoticeBot(pywikibot.bot.Bot): |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
@ -46,7 +46,8 @@ ON `cl_from` = `page_id` |
|
|
|
""".format(cat=jogobot.config["red.missingnotice"]["article_category"]) |
|
|
|
|
|
|
|
def __init__( self, genFactory, **kwargs ): |
|
|
|
pass |
|
|
|
|
|
|
|
super(type(self), self).__init__(**kwargs) |
|
|
|
|
|
|
|
def run( self ): |
|
|
|
pass |
|
|
@ -115,6 +116,34 @@ ON `cl_from` = `page_id` |
|
|
|
links=jogobot.config["red.missingnotice"]["link_sep"].join( |
|
|
|
links[1] ) ) |
|
|
|
|
|
|
|
def update_page( self, wikipage=None): |
|
|
|
""" |
|
|
|
Handles the updating process of the wikipage |
|
|
|
|
|
|
|
@param wikipage Wikipage to put text on, otherwise use configured page |
|
|
|
@type wikipage str |
|
|
|
""" |
|
|
|
|
|
|
|
# if not given get wikipage from config |
|
|
|
if not wikipage: |
|
|
|
wikipage = jogobot.config["red.missingnotice"]["wikipage"] |
|
|
|
|
|
|
|
# Create page object for wikipage |
|
|
|
page = pywikibot.Page(pywikibot.Site(), wikipage) |
|
|
|
|
|
|
|
# Define edit summary |
|
|
|
summary = jogobot.config["red.missingnotice"]["edit_summary"] |
|
|
|
|
|
|
|
# Make sure summary starts with "Bot:" |
|
|
|
if not summary[:len("Bot:")] == "Bot:": |
|
|
|
summary = "Bot: " + summary.strip() |
|
|
|
|
|
|
|
# Concatenate new text |
|
|
|
new_text = "\n".join(self.page_content) |
|
|
|
|
|
|
|
# Save new text |
|
|
|
self.userPut( page, page.text, new_text, summary=summary ) |
|
|
|
|
|
|
|
@classmethod |
|
|
|
def get_categorized_articles( cls ): |
|
|
|
""" |
|
|
|