Skip to content

Commit

Permalink
tags added into content to fix notification parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Nov 19, 2023
1 parent ab71dc7 commit 6274835
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apprise/plugins/NotifyDiscord.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,24 @@ def send(self, body, title='', notify_type=NotifyType.INFO, attach=None,
'users': [],
'roles': [],
}

_content = []
for (is_role, no, value) in results:
if value:
payload['allow_mentions']['parse'].append(value)
_content.append(f'@{value}')

elif is_role:
payload['allow_mentions']['roles'].append(no)
_content.append(f'<@&{no}>')

else: # is_user
payload['allow_mentions']['users'].append(no)
_content.append(f'<@{no}>')

if self.notify_format == NotifyFormat.MARKDOWN:
# Add pingable elements to content field
payload['content'] = '👉 ' + ' '.join(_content)

if not self._send(payload, params=params):
# We failed to post our message
Expand Down

0 comments on commit 6274835

Please sign in to comment.