Notifications - Include triggered text token as {{triggered_text}} in notifications, so you can send just the content that matches. (#1485)

This commit is contained in:
dgtlmoon
2023-03-21 19:16:13 +01:00
committed by GitHub
parent c96ece170a
commit d5f574ca17
5 changed files with 129 additions and 20 deletions

View File

@@ -287,3 +287,18 @@ def workarounds_for_obfuscations(content):
content = re.sub('<!--\s+-->', '', content)
return content
def get_triggered_text(content, trigger_text):
triggered_text = []
result = strip_ignore_text(content=content,
wordlist=trigger_text,
mode="line numbers")
i = 1
for p in content.splitlines():
if i in result:
triggered_text.append(p)
i += 1
return triggered_text