This commit is contained in:
Frisk 2018-11-13 19:20:12 +01:00
parent d80367dd85
commit cadb035ba3
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C

View file

@ -676,6 +676,8 @@ def first_pass(
webhook_formatter("new", STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, webhook_formatter("new", STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment,
oldrev=change["old_revid"], pageid=change["pageid"], diff=change["revid"], oldrev=change["old_revid"], pageid=change["pageid"], diff=change["revid"],
size=change["newlen"]) size=change["newlen"])
elif change["type"] == "categorize":
return
else: else:
logging.warning("This event is not implemented in the bot.") logging.warning("This event is not implemented in the bot.")
logging.debug("Cannot process event {}".format(change)) logging.debug("Cannot process event {}".format(change))
@ -917,8 +919,8 @@ class recent_changes_class(object):
logging.debug("ids is empty, triggering clean fetch") logging.debug("ids is empty, triggering clean fetch")
clean = True clean = True
changes = self.safe_request( changes = self.safe_request(
"https://{wiki}.gamepedia.com/api.php?action=query&format=json&list=recentchanges&rcshow=!bot&rcprop=title%7Credirect%7Ctimestamp%7Cids%7Cloginfo%7Cparsedcomment%7Csizes%7Cflags%7Ctags%7Cuser&rclimit={amount}&rctype=edit%7Cnew%7Clog%7Cexternal%7Ccategorize".format( "https://{wiki}.gamepedia.com/api.php?action=query&format=json&list=recentchanges&rcshow=!bot&rcprop=title%7Credirect%7Ctimestamp%7Cids%7Cloginfo%7Cparsedcomment%7Csizes%7Cflags%7Ctags%7Cuser&rclimit={amount}&rctype=edit%7Cnew%7Clog%7Cexternal{categorize}".format(
wiki=settings["wiki"], amount=amount)) wiki=settings["wiki"], amount=amount, categorize="%7Ccategorize" if settings["show_added_categories"] else ""))
if changes: if changes:
try: try:
changes = changes.json()['query']['recentchanges'] changes = changes.json()['query']['recentchanges']
@ -960,7 +962,7 @@ class recent_changes_class(object):
else: else:
logging.debug( logging.debug(
"There were too many new events, but the limit was high enough we don't care anymore about fetching them all.") "There were too many new events, but the limit was high enough we don't care anymore about fetching them all.")
if settings["show_added_categories"] and change["type"] == "categorize": if change["type"] == "categorize":
cat_title = change["title"].split(':', 1)[1] cat_title = change["title"].split(':', 1)[1]
# I so much hate this, blame Markus for making me do this # I so much hate this, blame Markus for making me do this
if change["revid"] not in categorize_events: if change["revid"] not in categorize_events: