kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Discord:// notification size limit - also includes the notification title
rodzic
f9594aeffb
commit
9e71f2aa35
|
@ -66,13 +66,20 @@ def process_notification(n_object, datastore):
|
|||
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
|
||||
payload_max_size = 1700
|
||||
# Trim everything to a max of 1700 total chars (leave some for padding, control etc)
|
||||
# Incase n_title > 1700
|
||||
# basically trim back the body until the total size fits our threshold
|
||||
# and trim off the n_title to fit always.
|
||||
body_limit = max(0, payload_max_size - len(n_title))
|
||||
body = n_body[0:body_limit] if 'discord://' in url else n_body
|
||||
|
||||
apobj.add(url)
|
||||
|
||||
apobj.notify(
|
||||
title=n_title,
|
||||
body=body,
|
||||
body_format=n_format)
|
||||
title=n_title[0:payload_max_size],
|
||||
body=body,
|
||||
body_format=n_format)
|
||||
|
||||
apobj.clear()
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="pure-form-message-inline">
|
||||
<ul>
|
||||
<li>Use <a target=_new href="https://github.com/caronc/apprise">AppRise URLs</a> for notification to just about any service! <i><a target=_new href="https://github.com/dgtlmoon/changedetection.io/wiki/Notification-configuration-notes">Please read the notification services wiki here for important configuration notes</a></i>.</li>
|
||||
<li><code>discord://</code> notifications are cut at 2,000 characters in length.</li>
|
||||
<li><code>discord://</code> only supports a maximum <strong>2,000 characters</strong> of notification text, including the title.</li>
|
||||
<li><code>tgram://</code> bots cant send messages to other bots, so you should specify chat ID of non-bot user.</li>
|
||||
<li>Go here for <a href="{{url_for('notification_logs')}}">notification debug logs</a></li>
|
||||
</ul>
|
||||
|
|
Ładowanie…
Reference in New Issue