mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Fix #171
This commit is contained in:
parent
a57d0f58a9
commit
077a103d35
|
@ -129,11 +129,13 @@ def send_to_discord_webhook(data: Optional[DiscordMessage], metadata: DiscordMes
|
|||
result = requests.Session().send(req, timeout=10)
|
||||
update_ratelimit(result)
|
||||
if AUTO_SUPPRESSION_ENABLED and metadata.method == "POST":
|
||||
# TODO Prepare request with all of safety checks
|
||||
if 199 < result.status_code < 300: # check if positive error log
|
||||
try:
|
||||
add_message_redaction_entry(*metadata.dump_ids(), repr(data), result.json().get("id"))
|
||||
except ValueError:
|
||||
logger.error("Couldn't get json of result of sending Discord message.")
|
||||
else:
|
||||
pass
|
||||
except requests.exceptions.Timeout:
|
||||
logger.warning("Timeouted while sending data to the webhook.")
|
||||
return 3
|
||||
|
|
|
@ -974,6 +974,8 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes):
|
|||
else:
|
||||
tag_displayname.append(tag)
|
||||
embed.add_field(_("Tags"), ", ".join(tag_displayname))
|
||||
if len(embed["title"]) > 254:
|
||||
embed["title"] = embed["title"][0:253]+"…"
|
||||
logger.debug("Current params in edit action: {}".format(change))
|
||||
if categories is not None and not (len(categories["new"]) == 0 and len(categories["removed"]) == 0):
|
||||
new_cat = (_("**Added**: ") + ", ".join(list(categories["new"])[0:16]) + ("\n" if len(categories["new"])<=15 else _(" and {} more\n").format(len(categories["new"])-15))) if categories["new"] else ""
|
||||
|
|
Loading…
Reference in a new issue