Skip to content

Commit

Permalink
Use default value if group has no value
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLovinator1 committed Jul 16, 2023
1 parent b7354df commit e1e9a43
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions discord_twitter_webhooks/_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,24 @@ def get_group(reader: Reader, uuid: str) -> Group:
try:
group = reader.get_tag((), uuid)
return Group(
uuid=group["uuid"],
name=group["name"],
usernames=group["usernames"],
webhooks=group["webhooks"],
rss_feeds=group["rss_feeds"],
send_retweets=group["send_retweets"],
send_replies=group["send_replies"],
only_send_if_media=group["only_send_if_media"],
send_as_embed=group["send_as_embed"],
send_as_link=group["send_as_link"],
send_as_text=group["send_as_text"],
send_as_text_username=group["send_as_text_username"],
translate=group["translate"],
translate_to=group["translate_to"],
translate_from=group["translate_from"],
unescape_html=group["unescape_html"],
remove_copyright=group["remove_copyright"],
created_at=group["created_at"],
uuid=group.get("uuid", uuid),
name=group.get("name", Group.name),
usernames=group.get("usernames", []),
webhooks=group.get("webhooks", []),
rss_feeds=group.get("rss_feeds", []),
send_retweets=group.get("send_retweets", Group.send_retweets),
send_replies=group.get("send_replies", Group.send_replies),
only_send_if_media=group.get("only_send_if_media", Group.only_send_if_media),
send_as_embed=group.get("send_as_embed", Group.send_as_embed),
send_as_link=group.get("send_as_link", Group.send_as_link),
send_as_text=group.get("send_as_text", Group.send_as_text),
send_as_text_username=group.get("send_as_text_username", Group.send_as_text_username),
translate=group.get("translate", Group.translate),
translate_to=group.get("translate_to", Group.translate_to),
translate_from=group.get("translate_from", Group.translate_from),
unescape_html=group.get("unescape_html", Group.unescape_html),
remove_copyright=group.get("remove_copyright", Group.remove_copyright),
created_at=group.get("created_at", datetime.now(tz=timezone.utc).isoformat()),
)
except TagNotFoundError:
logger.info("Group {} not found.", uuid)

0 comments on commit e1e9a43

Please sign in to comment.