Fix to crashing hook

This commit is contained in:
Frisk 2021-05-23 21:04:37 +02:00
parent a0a4cd5352
commit 4ffac4210e
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
2 changed files with 2 additions and 1 deletions

1
.gitignore vendored
View file

@ -9,6 +9,7 @@ lastchange.txt
/venv/
/lokalize-scripts/
/venvv/
/.idea/
__pycache__
*.bat
*.code-workspace

View file

@ -30,7 +30,7 @@ def example_post_hook(message, metadata, context, change):
if discord_users and change["ns"] in [2, 3, 202] and not "/" in change["title"]:
username = change["title"].split(':', 1)[1]
if discord_users.get(username, "") and username != change["user"]:
message.webhook_object["content"] = (content or "") + " <@{}>".format(discord_users[username])
message.webhook_object["content"] = (message.webhook_object.get("content", "") or "") + " <@{}>".format(discord_users[username])
if message.webhook_object["allowed_mentions"].get("users", []):
message.webhook_object["allowed_mentions"]["users"].append(discord_users[username])
else: