From 30b30cbf1ed2aabd97527523cdff6373f26f763b Mon Sep 17 00:00:00 2001 From: Owyn Date: Wed, 12 Jan 2022 10:43:09 +0300 Subject: [PATCH] Some actually useful examples (#582) --- resources/docs/Documentation.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/resources/docs/Documentation.md b/resources/docs/Documentation.md index dee1669b3..4b4649ee0 100644 --- a/resources/docs/Documentation.md +++ b/resources/docs/Documentation.md @@ -170,6 +170,28 @@ Note that `MessageObject` attributes which can be synchronized with service are | Method | `runExecutableGetOutput(String, String[])` | `String` | `utils.runExecutableGetOutput('cmd.exe', ['/c', 'dir'])` | Launches external executable with optional parameters, reads its standard output and returns the output when executable finishes. #### Examples +Accept only messages/articles with title containing "Series Name" in it: +```js +function filterMessage() { + if (msg.title.indexOf('Series Name') != -1) { + return MessageObject.Accept; + } else { + return MessageObject.Ignore; + } +} +``` + +Accept only messages/articles with title NOT containing "Other Series Name" or "Some other title" in it: +```js +function filterMessage() { + if (msg.title.indexOf('Other Series Name') == -1 && msg.title.indexOf('Some other title') == -1) { + return MessageObject.Accept; + } else { + return MessageObject.Ignore; + } +} +``` + Accept only messages/articles from "Bob", while also mark them "important": ```js function filterMessage() {