Fix issue when the content is revdeleted before we fetch diff

(just don't provide diffs on MediaWiki errors)
This commit is contained in:
Frisk 2021-11-12 16:34:21 +01:00
parent 468c381883
commit b6065a8188
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC

View file

@ -81,7 +81,7 @@ def embed_edit(ctx: Context, change: dict) -> DiscordMessage:
changed_content = ctx.client.make_api_request(
"?action=compare&format=json&fromrev={oldrev}&torev={diff}&topst=1&prop=diff".format(
diff=change["revid"], oldrev=change["old_revid"]), "compare", "*")
except ServerError:
except (ServerError, MediaWikiError):
changed_content = None
if changed_content:
parse_mediawiki_changes(ctx, changed_content, embed)