Specify our Discord avatar_url as default avatar_url

pull/534/head
dgtlmoon 3 years ago
parent 9fc2fe85d5
commit 1890881977

@ -54,17 +54,28 @@ def process_notification(n_object, datastore):
url = url.strip() url = url.strip()
if len(url): if len(url):
print(">> Process Notification: AppRise notifying {}".format(url)) print(">> Process Notification: AppRise notifying {}".format(url))
apobj.add(url)
with apprise.LogCapture(level=apprise.logging.DEBUG) as logs: with apprise.LogCapture(level=apprise.logging.DEBUG) as logs:
# Re 323 - Limit discord length to their 2000 char limit total # Re 323 - Limit discord length to their 2000 char limit total or it wont send.
# Or it wont send.
# Because different notifications may require different pre-processing, run each sequentially :( # Because different notifications may require different pre-processing, run each sequentially :(
body = n_body[0:2000-len(n_title)] if 'discord://' in url else n_body # 2000 bytes minus -
# 200 bytes for the overhead of the _entire_ json payload, 200 bytes for {tts, wait, content} etc headers
# Length of URL - Incase they specify a longer custom avatar_url
# So if no avatar_url is specified, add one so it can be correctly calculated into the total payload
k = '?' if not '?' in url else '&'
if not 'avatar_url' in url:
url += k + 'avatar_url=https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png'
body = n_body[0:1800-len(n_title)-len(url)] if 'discord://' in url else n_body
apobj.add(url)
apobj.notify( apobj.notify(
title=n_title, title=n_title,
body=body, body=body,
body_format=n_format) body_format=n_format)
apobj.clear()
# Incase it needs to exist in memory for a while after to process(?) # Incase it needs to exist in memory for a while after to process(?)
apobjs.append(apobj) apobjs.append(apobj)

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Loading…
Cancel
Save