# Welcome to v6.0.0

{% hint style="danger" %}
This documentation site is deprecated. Please visit the README of <https://github.com/synzen/MonitoRSS> for hosting instructions.
{% endhint %}

## Discord.RSS has been renamed to MonitoRSS.

{% hint style="warning" %}
Commands have been disabled on the public bot in anticipation of [Discord's breaking permission changes](https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Access-Deprecation-for-Verified-Bots). All functions must be done either through the current control panel at <https://monitorss.xyz> or the newer one at <https://my.monitorss.xyz>
{% endhint %}

## Migration (v5 to v6)

Before updating, always backup your server files with the relevant backup command.

### MongoDB

1. Set up <https://github.com/synzen/MonitoRSS-Clone>, using the same `config.database.uri`  (refer to [v6 configuration](/configuration/bot-configuration))
2. Run `npm install`
3. Run `npm run migrate-v6`

Data from old collections will be migrated to new, differently-named collections.

### Databaseless

1. Set up <https://github.com/synzen/MonitoRSS-Clone>, using the same `config.database.uri` (refer to [v6 configuration](/configuration/bot-configuration))
2. Run `npm install`
3. Copy the directory you specified in `config.database.uri` from your v5 directory to the one you set up for Discord.RSS-Clone
4. Run `npm run migrate-v6`

Old files will be migrated and split into multiple files in newly created folders within your `config.database.uri`.


# Bot

{% hint style="danger" %}
This documentation site is deprecated. Please visit the README of <https://github.com/synzen/MonitoRSS> for hosting instructions.
{% endhint %}

If you're using FreeBSD, more specific instructions can be found [here](https://github.com/synzen/MonitoRSS/issues/26), provided by Ultima.

If you're using Heroku, see [here](https://github.com/synzen/MonitoRSS/issues/45) (provided by [Macley-Kun](https://github.com/Macley-Kun)) or [here (more complicated, but needs no credit card)](https://github.com/synzen/MonitoRSS/issues/95) (provided by [codeinteger6](https://github.com/codeinteger6)).

#### Table of Contents

1. Requirements
2. Setup
3. Running

## Requirements

1. Node.js v12.16 to 14

## Setup

1. Install [Node.js](https://nodejs.org/en/) (must be at least v12.16).
2. Clone files from [https://github.com/synzen/MonitoRSS-Clone/](https://github.com/synzen/MonitoRSS-Clone) on the **master** branch
3. Use `npm install` in the directory from console to install all dependencies/modules. If you see any `make` errors, they can be ignored since they are optional dependencies.
4. Create and get a bot token from <https://discordapp.com/developers/applications/>.
   * "Create an Application" -> Click "Bot" on the left panel -> "Add Bot" -> Set icon and username -> "Save Changes" -> Click "Copy" under Token
5. Set the bot token and any other changes into settings/[config.bot.json](https://docs.monitorss.xyz/configuration/bot-configuration). You may copy the example json file in the settings folder, and rename it to config.bot.json
6. Click "OAuth2" on the left panel, then check the "bot" scope and whatever other permissions at the bottom. Use the generated invite URL to invite the bot.&#x20;
7. Configure whether the bot should use a MongoDB database. See [here](https://github.com/synzen/Discord.RSS/wiki/MongoDB-vs-Databaseless) for the difference.
   * **MongoDB** - Recommended (*only 64-bit systems are supported*). Follow below instructions is running it locally.
     * Install [MongoDB](https://www.mongodb.com/download-center/community) (v4.2+).
     * Start the DB server in console by `mongod`, or automatically on bootup (ubuntu/debian `sudo systemctl enable mongod.service`). It must be constantly running in the background.
   * **Databaseless** (if MongoDB is not possible)
     * Set the [config.bot.json](https://docs.monitorss.xyz/configuration/bot-configuration#bot) value of `database.uri` to a folder path where guild profiles will be stored.
8. If you intend to use Discord commands, you *must* enable Message Content Intent in Discord's control panel for your bot application. This is required for the beat to read and respond to Discord messages. See the image below.<br>

   <figure><img src="/files/WanecofbLcDybUN0Uoz5" alt=""><figcaption><p>Enable message content intent</p></figcaption></figure>

#### Sharding

Sharding is default behavior. If you want to explicitly define the number of shards, set `config.advanced.shards`.

{% hint style="danger" %}

## **Security Notice**

Do not *ever* post your bot token (or files containing your bot token) anywhere where anyone else can see or access it. With the token, your bot app can be accessed by anyone and might cause your account to be banned on behalf of someone else's actions.

I am not responsible for what happens if someone gets a hold of the token that happens to be the same one you use to run this bot.
{% endhint %}

## Running

Run `node bot.js` or `nodejs bot.js`.&#x20;

####


# Web Interface

{% hint style="danger" %}
This documentation site is deprecated. Please visit the README of <https://github.com/synzen/MonitoRSS> for hosting instructions.
{% endhint %}

These are general instructions on how to get the web UI up and running. Steps may vary depending on what other tools you may want to use.  The web does not fetch any feeds, and is only used to edit feeds.

{% hint style="warning" %}
If you're using a reverse proxy, **make sure it's not decoding request URIs**. For apache, see [here](https://stackoverflow.com/questions/4390436/need-to-allow-encoded-slashes-on-apache). For nginx, see [here](https://serverfault.com/questions/459369/disabling-url-decoding-in-nginx-proxy).

Loading in the interface on a subpath is also not supported.
{% endhint %}

## Requirements

1. Node.js v12.16 or higher
2. MongoDB v4.2+
3. Redis ([persistence](https://redis.io/topics/persistence) is not required)

## Setup

You can then set up the bot and web app separately, or you can run them together.&#x20;

### Standalone from clone (recommended for high availability)

1. Follow setup steps for[ cloning the bot](/setting-up/bot), but in a separate directory (**separate** **from the original bot, so you have two different clones**). You may skip steps concerning config.bot.json.
2. Set up the required configs in settings/config.web.json (for details on each, see the [Web Interface configuration section of the wiki](/configuration/web-interface))
   1. `config.bot.token`
   2. `config.bot.redirectURI`&#x20;
   3. `config.bot.clientID`
   4. `config.bot.clientSecret`
   5. `config.database.uri` (This must be the same URI that the bot uses)
   6. `config.database.redis`
3. Add the same `config.bot.redirectURI` to your bot application at [Discord Developers](https://discordapp.com/developers/applications/) in the OAuth 2 section.
4. Run `node web.js`

### Coupled with Bot

1. Follow the setup steps for [cloning the bot](/setting-up/bot)
2. Set up the required configs in settings/config.web.json (for details on each, see the[ Web Interface configuration section of the wiki](/configuration/web-interface))
   1. `config.bot.token`
   2. `config.bot.redirectURI`&#x20;
   3. `config.bot.clientID`
   4. `config.bot.clientSecret`
   5. `config.database.uri` (This must be the same URI that the bot uses in in config.bot.json)
   6. `config.database.redis`
3. Add the same `config.bot.redirectURI` to your bot application at [Discord Developers](https://discordapp.com/developers/applications/) in the OAuth 2 section.
4. Run `node bot-web.js`. This will run the bot and web at the same time, in the same process. You may also set the env variable `DRSS_START` to `bot-web` and run `server.js` instead.

## Access

&#x20;Go to `http://localhost:port` where `port` is what you set `config.http.port` to. If HTTPS is enabled, all requests are redirected to `https://`.


# Setting up HTTPS

{% hint style="info" %}
This spins up a **Node.js** web server for HTTPS. If you're using a reverse proxy for HTTPS, there is no need to do this.
{% endhint %}

1. Set `config.https.enabled` to `true`.
2. Set `config.https.privateKey`, `config.https.certificate` and `config.https.chain` paths to the relevant files.

All requests are then redirected to `https://`.


# Docker

{% hint style="danger" %}
This documentation site is deprecated. Please visit the README of <https://github.com/synzen/MonitoRSS> for hosting instructions.
{% endhint %}

## Running

### Image

Both the bot and web are started from the clone image (either in separate containers or combined in one):

`docker pull synzen/monitorss`

Note that all the required configurations still need to be set through [environment variables](/configuration/environment-variables). To know which ones are required, see the [Bot Config](/configuration/bot-configuration) or [Web Interface Config](/configuration/web-interface) section.

### docker-compose

A Docker compose file is provided in the clone repository at <https://github.com/synzen/MonitoRSS-Clone>

`docker-compose up`

By default, the compose file will start containers for Redis, MongoDB, the bot and the web. The env variable `DRSS_START` dictates whether the bot or the web is started (`bot`, `web` or `bot-web` for both).&#x20;

{% hint style="info" %}
The web app must have access to the same database as the bot to access the same data. Be sure to use the same database URI for both the bot and the web application in their respective configs.
{% endhint %}

## Restart Policy Advisory

{% hint style="danger" %}
Be wary of doing infinite restarts. This may lead to you being blocked or banned by Discord.
{% endhint %}


# Existing Bot/NPM

{% hint style="danger" %}
This documentation site is deprecated. Please visit the README of <https://github.com/synzen/MonitoRSS> for hosting instructions.
{% endhint %}

## Running the Bot

### Simple Way

[Setup](https://github.com/synzen/Discord.RSS/wiki/Setup) the bot and use the same bot token.

### Programmatically

Install `monitorss`:

```
npm install monitorss
```

or directly from dev branch for the latest updates via the format `npm install author/repo#branch`:

```
npm install synzen/monitorss#dev
```

```javascript
const MonitoRSS = require('monitorss')

const options = {
  setPresence: true,
  // Config format is same as config.json
  config: {
    bot: {
      token: "abc123"
    }
  }
}

const drss = new MonitoRSS.ClientManager(options)
drss.start()
```

#### ClientManager Options

An object can be passed in as the first parameter of `ClientManager`,&#x20;

| Name          | Type    | Description                                                                                   |
| ------------- | ------- | --------------------------------------------------------------------------------------------- |
| `setPresence` | Boolean | Set the bot's presence (online, dnd, etc.)                                                    |
| `schedules`   | Object  | Custom schedules to put certain URLs on a different retrieval cycle. See below for more info. |
| `config`      | String  | Configuration object whose structure matches that of config.bot.json.                         |

**Custom Schedules**

[Custom schedules](/configuration/bot-configuration/schedules) is passed as an object of objects in the format of

```javascript
{
    feed43: {
        refreshRateMinutes: 60,
        keywords: ["feed43"]
    },
    otherName: {
        refreshRateMinutes: 30,
        keywords: ["other", "words"]
    }
]
```

## Using Structures

If you don't want to run the bot and just want to have access to its structures:

```javascript
npm install monitorss
```

```javascript
const Feed = require('monitorss').Feed

async function myfunc() {
    await MonitoRSS.setupModels(mongoURI, mongoOptions)
    // Do what you want with Feed now
}


```


# Process Managers

{% hint style="danger" %}
This documentation site is deprecated. Please visit the README of <https://github.com/synzen/MonitoRSS> for hosting instructions.
{% endhint %}

Optionally use a process manager to keep the process running in the background (make sure you manually run it after setting up to resolve any issues *before* doing this):

* [Process Manager 2 (pm2)](https://www.npmjs.com/package/pm2)
* [forever](https://www.npmjs.com/package/forever)
* systemd
* Whatever other process manager you want

{% hint style="danger" %}
Be wary of your process manager(s) doing infinite restarts. This may lead to you being blocked or banned by Discord.
{% endhint %}

## PM2 / Forever

1. `npm install -g pm2` or `npm install -g forever` in terminal.
   * add `sudo` before npm if you have permission issues.
2. `cd MonitoRSS` assuming your folder is named MonitoRSS
3. `pm2 start bot.js` or `forever start bot.js`

### Realtime Log Tracking

1. Use `pm2 list` or `forever list` to show the process ID.
2. `pm2 logs processID` or `forever logs processID -f` - you'll now be shown a short recent history of the bot logs, and any further

### Complete History/Logs of Bot

1. Use `pm2 show processID`/`forever list` to show the `out log path`/`logfile` location.
2. `cat /my/location/<log name>.log`. This is not realtime tracking.

### Clearing History

1. `pm2 flush`/`forever cleanlogs`

### Stopping the Bot

1. `pm2 stop processID`/`forever stop processID`

### Restarting

1. `pm2 restart processID`/`forever restart processID`

## systemd

(credited to [Danpiel](https://github.com/synzen/Discord.RSS/issues/4))

1. Create unit file in `/etc/systemd/system/discord-rss.service` with contents

```
[Unit]
Description=Discord RSS bot

[Service]
WorkingDirectory=/opt/discord-rss/
ExecStart=/usr/bin/node /opt/discord-rss/server.js
Type=simple
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=discord-rss

[Install]
WantedBy=multi-user.target
```

1. Reload systemd to take new configuration `sudo systemctl daemon-reload`
2. Start it with `sudo systemctl start discord-rss`
3. Enable autostart with `sudo systemctl enable discord-rss`
4. Logs can be checked with `sudo journalctl -fu discord-rss`


# Staying Updated

{% hint style="danger" %}
This documentation site is deprecated. Please visit the README of <https://github.com/synzen/MonitoRSS> for hosting instructions.
{% endhint %}

## Checking Versions

You can always check the latest versions at <https://github.com/synzen/Discord.RSS/releases> and <https://github.com/synzen/Discord.RSS-Web/releases>. Both the bot and web app are independently developed. Using the [clone repository](https://github.com/synzen/Discord.RSS-Clone) is necessary to ensure compatibility between the two.

Their respective versions used in the clone repository can be checked in the [package.json file](https://github.com/synzen/Discord.RSS-Clone/blob/master/package.json). This will be updated as the bot and web repos are updated.

You can use GitHub RSS feeds to automatically track them.

### Relevant Feeds To Track

#### Clone Updates

Releases are only made here when files related to the clone repo have been changed. So when either the bot or web are updated, a commit will be made, but not a release. You may follow use the RSS feed for commits whenever the bot or web is updated:

<https://github.com/synzen/discord.rss-clone/commits/master.atom>

Or releases when clone files have been changed:

<https://github.com/synzen/discord.rss-clone/releases.atom>

#### Bot Releases

<https://github.com/synzen/discord.rss/releases.atom>

#### Web Updates

No releases are currently being made on web since it is not technically released yet. If you'd still like to follow development, you can use the commit feed:

<https://github.com/synzen/discord.rss-web/commits/master.atom>

## Updating

If you set up the clone repository correctly, all you have to do to grab and install the latest versions for both the bot and web:

```bash
git pull origin master
npm ci
```

This will not overwrite your `config.web.json` and `config.bot.json`. Make sure you restart the app afterwards.


# Bot Config

Configs are set in the settings/config.bot.json file, or if you're using the bot programmatically via npm, pass in the config object to override defaults as the first parameter to the constructor (see [here](/setting-up/existing-bot) for more info on programmatically). Configs can also be set via [environment variables](/configuration/environment-variables).

Any configs with an asterisk `*` beside it indicates that it is *required* and the bot cannot function without them. There will be a automatic check on startup for any invalid/missing configs.

**Type Definitions:**

Number - A non-negative integer (no quotes).

Boolean - Either `true` or `false` (no quotes).

String - Text that must be enclosed with quotes. Example: `"my text"`

Array\[String] - Multiple strings enclosed by `[` and `]`, separated by commas. Example: `["mythinghere", "mysecondthinghere"]` or with a single item: `["myotherthing"]`

Object - A [JSON](https://www.w3schools.com/js/js_json_syntax.asp) object.

## log

| Config          | Type    | Description                                                                                                                                                                                                             |
| --------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `level`         | String  | Verbosity of the logs desired. Must be `"silent"`, `"trace"`, `"debug"`, `"info"`, `"owner"`, `"warn"`, `"error"`, or `"fatal"`. Default is `"info"`. The lower the level, the more verbose (except silent).            |
| `destination`   | String  | Direct JSON logs to a file. Must be an absolute path. Default is `""` (no file output, only console). You may use a CLI tool like [pino-pretty](https://github.com/pinojs/pino-pretty) to filter or prettify JSON logs. |
| `linkErrs`      | Boolean | Log any request failures during connections to feed URLs. Default is `true`.                                                                                                                                            |
| `unfiltered`    | Boolean | Log article links/titles that wasn't sent due to failing to pass specified filters. Default is `true`.                                                                                                                  |
| `failedFeeds`   | Boolean | Log article won't be fetched sent due to exceeding the fail limit. Default is `true`.                                                                                                                                   |
| `rateLimitHits` | Boolean | Log when rate limits are hit within the discord.js library. Default is `true`.                                                                                                                                          |

## bot

| Config                     | Type           | Description                                                                                                                                                                    |
| -------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `token`\*                  | String         | Bot token to login.                                                                                                                                                            |
| `enableCommands`           | Boolean        | Allow command use by people with relevant permissions. If set to `false`, only owners will be able to use commands. Default is `true`.                                         |
| `prefix`\*                 | String         | Prefix for [Discord commands](https://github.com/synzen/Discord.RSS/wiki/Discord-Commands). Default is `rss.`.                                                                 |
| `status`                   | String         | Must be `"online"`, `"idle"`, `"dnd"` or `"invisible"`. Default is `"online"`.                                                                                                 |
| `activityType`             | String         | Must be `"PLAYING"`, `"WATCHING"`, `"LISTENING"`, `"STREAMING"` or an empty string. Default is `""`. Rate limited by Discord.                                                  |
| `activityName`             | String         | Displayed next to the activity type. Default is `""`. Rate limited by Discord.                                                                                                 |
| `streamActivityURL`        | String         | Stream URL for `"STREAMING"` activityType. only YouTube and Twitch links will be accepted by Discord. Default is `""`. Rate limited by Discord.                                |
| `ownerIDs`                 | Array\[String] | User IDs who have access to Bot Owner commands. Default is `[]`.                                                                                                               |
| `menuColor`                | String         | Sidebar color of the Discord embed menu commands, between 0 and 16777215. Must be an [*integer* color](https://www.shodor.org/stella2java/rgbint.html). Default is `7833753`.  |
| `deleteMenus`              | Boolean        | Automatically delete all messages sent within a series of menus after the series has completed. *This requires the bot to have Manage Messages permission.* Default is `true`. |
| `runSchedulesOnStart`      | Boolean        | Fetch all feeds for all schedules on startup. If you're constantly rebooting, it might be wise to set this to `false`. Default is `true`.                                      |
| `exitOnSocketIssues`       | Boolean        | Force the bot to exit if it encounters WebSocket issues. Default is `true`.                                                                                                    |
| `exitOnDatabaseDisconnect` | Boolean        | Force the bot to exit if MongoDB is disconnected. Default is `false`.                                                                                                          |
| `exitOnExcessRateLimits`   | Boolean        | Force the bot to exit if 100 rate limits were hit within 60 seconds within any shards. This is used as a failsafe. Default is `true`.                                          |
| `userAgent`                | String         | The user agent to send feed requests with. Default is `"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0"`                                       |
| `feedParseTimeoutMs`       | Number         | Milliseconds to wait for feed parsing until it times out. Default is `10000`.                                                                                                  |
| `feedRequestTimeoutMs`     | Number         | Milliseconds until a feed request times out. Default is `15000`.                                                                                                               |

## database

| Config                  | Type   | Description                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `uri`\*                 | String | [MongoDB connection string](https://docs.mongodb.com/manual/reference/connection-string/) *or* a directory for a [databaseless](/configuration/mongodb-vs-databaseless) configuration (both relative and absolute paths work). See [here](https://github.com/synzen/Discord.RSS/wiki/MongoDB-vs-Databaseless) for differences. Default is `"mongodb://localhost/rss"`. |
| `connection`            | Object | The [connection options object](http://mongoosejs.com/docs/connections.html#options) options passed through Mongoose. This can be used for other types of authentication. Irrelevant for [databaseless](/configuration/mongodb-vs-databaseless).                                                                                                                       |
| `articlesExpire`        | Number | Number of days before articles are removed from the database. This affects how the bot decides what is new or not. Set to `0` to never expire. Irrelevant for [databaseless](/configuration/mongodb-vs-databaseless). Default is `14`.                                                                                                                                 |
| `deliveryRecordsExpire` | Number | Number of days before delivery records are removed from the database. These records are for debugging/historical purposes. Irrelevant for [databaseless](/configuration/mongodb-vs-databaseless). Default is `5`.                                                                                                                                                      |

## feeds

| Config                     | Type           | Description                                                                                                                                                                                                                                                            |
| -------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `refreshRateMinutes`       | Number         | Check for new feeds regularly at every interval specified in minutes. If you set this too low, you risk being banned by sites for spamming them. Default is `10`.                                                                                                      |
| `articleDequeueRate`       | Number         | Rate that articles are sent per second, used to alleviate rate limits by Discord. Must be >0. If it is a decimal <1, then the rate is `1 article per (1/(articleDequeueRate)) seconds`.  If it is >1, the rate is `(articleDequeueRate) per 1 second`. Default is `1`. |
| `articleRateLimit`         | Number         | Maximum number of articles to send within a channel, regardless of the number of feeds, during a cycle. Default is `0` (unlimited).                                                                                                                                    |
| `articleDailyChannelLimit` | Number         | Maximum number of articles to send within a channel within a day. Limit is reset every day 00:00:00 UTC. This requires `config.database.deliveryRecordsExpire` to be greater than `1` to work correctly. Default is `0` (unlimited).                                   |
| `timezone`                 | String         | This is for the {date} tag customization. To add your own timezone, use a timezone from [this list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) under the TZ column. Default is `"UTC"`.                                                             |
| `dateFormat`               | String         | Format how {date} is shown. See [details here](http://momentjs.com/docs/#/displaying/format/). Whatever is here, will be inside `.format(<timeFormat>)` Default is `"ddd, D MMMM YYYY, h:mm A z"`.                                                                     |
| `dateFallback`             | Boolean        | Use the current date and time if there was no published date found for an article. Default is `false`.                                                                                                                                                                 |
| `dateLanguage`             | String         | The default language for `{date}` placeholders. Default is `"en"`.                                                                                                                                                                                                     |
| `dateLanguageList`         | Array\[String] | The list of available languages that can be changed via the `date` command. Default is `["en"]`.                                                                                                                                                                       |
| `max`                      | Number         | Maximum number of feeds per server. Default is `0` (unlimited).                                                                                                                                                                                                        |
| `hoursUntilFail`           | Number         | Hours to wait until connection attempts of a feed stops after its initial failure and non-stop consecutive failures. Default is `0` (never).                                                                                                                           |
| `notifyFail`               | Boolean        | Notify when a feed has exceeded `hoursUntilFail` in all Discord channels that it is active in. Default is `true`.                                                                                                                                                      |
| `sendFirstCycle`           | Boolean        | Send unseen messages on the first feed cycle that were not caught during bot downtime after it has restarted. This may result in message spam after a long downtime. Default is `true`.                                                                                |
| `cycleMaxAge`              | Number         | Same as `defaultMaxAge` except instead of initialization, it applies to articles on every cycle. Usually not necessary to change unless feeds are incorrectly formatted that puts old articles as "new". Default is `1`.                                               |
| `defaultText`\*            | String         | If no custom message is defined for a specific feed, this will be the message the feed will fallback to.                                                                                                                                                               |
| `imgPreviews`              | Boolean        | Toggle automatic Discord image link embedded previews for image links found inside placeholders such as {description}. Default is `true`.                                                                                                                              |
| `imgLinksExistence`        | Boolean        | Remove image links found inside placeholders such as {description}. If disabled, all image src links in such placeholders will be removed. Default is `true`.                                                                                                          |
| `checkDates`               | Boolean        | Date checking ensures that articles that are 1 day(s) old or has invalid/no pubdates are't sent. Default is `true`.                                                                                                                                                    |
| `formatTables`             | Boolean        | If table formatting is enabled, they should be enclosed in code blocks to ensure uniform spacing. Default is `false`.                                                                                                                                                  |
| `directSubscribers`        | Boolean        | Allow users to add themselves as subscribers to a feed through the `sub` command. Default is `false`.                                                                                                                                                                  |
| `decode`                   | Object         | Specify what encoding a particular feed has to decode it. The feed URLs are the keys, and the encoding is the value.                                                                                                                                                   |

## advanced

**Only change these if you&#x20;*****know*****&#x20;what you're doing. The defaults already provide the best performance for small cases (less than or equal to a couple hundred URLs to request) for most server specs.**

| Config            | Type   | Description                                                                                                    |
| ----------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| `shards`          | Number | Number of shards to spawn. Default is `0` (let Discord decide how many shards it should spawn).                |
| `batchSize`       | Number | Number of URLs in a batch concurrently requested in a forked process. Default is `400`.                        |
| `parallelBatches` | Number | Number of batches of URLs in a run that may run in parallel. Default is `1`.                                   |
| `parallelRuns`    | Number | Number of schedule runs that may run in parallel if a run starts before the last run finishes. Default is `1`. |

## webURL

An optional config, used to show the URL in the `help` command.


# Schedules

A custom schedule is a way to put feeds with certain specified words in their links on a separate schedule from everything else. Every schedule is defined in a file named settings/schedules.json. For example:

{% code title="settings/schedules.json" %}

```javascript
{
    "feed43": {
        "refreshRateMinutes": 100,
        "keywords": [
            "feed43",
            "feed43.com"
        ]
    },
    "some other one": {
        "refreshRateMinutes": 1000,
        "keywords": [
            "whatever.com"
        ]
    }
}
```

{% endcode %}

Keywords is an array of words that the links must include. Note that this is done with the function `<string>.includes`. This means that if you `"a"` into the keywords array, it will trigger all links that has the letter `a` in it.

Any links assigned to a custom schedule (the assignment of links to custom schedules is logged on initialization, specifying what link is assigned to what schedule) will be excluded from the default schedule. If more than one schedule's keywords matches a feed link, whichever schedule gets to it first will 'claim' it.

You can also specify feeds by their IDs:

{% code title="settings/schedules.json" %}

```javascript
{
    "feed43": {
        "refreshRateMinutes": 15,
        "feeds": [
            "id123"
        ]
    }
}
```

{% endcode %}

To get feed IDs, you may use the `backup` command by looking for the `_id` key in objects within the  `feeds`  array.


# Web Interface Config

Configurations are set via file in the repository https\://github.com/synzen/Discord.RSS-Clone

![Preview of the web UI](/files/-M2xvRktUENvrfgKmuwE)

Configs are set in the settings/config.web.json file. If none exist, then you must create one that follows the example at settings/config.web.example.json.

Any configs with an asterisk `*` beside it indicates that it is *required* and the bot cannot function without them. There will be a automatic check on startup for any invalid/missing configs.

**Type Definitions:**

Number - A non-negative integer (no quotes).

Boolean - Either `true` or `false` (no quotes).

String - Text that must be enclosed with quotes. Example: `"my text"`

Array\[String] - Multiple strings enclosed by `[` and `]`, separated by commas. Example: `["mythinghere", "mysecondthinghere"]` or with a single item: `["myotherthing"]`

Object - A [JSON](https://www.w3schools.com/js/js_json_syntax.asp) object.

## log

| Config        | Type   | Description                                                                                                                                                                       |
| ------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `level`       | String | Verbosity of the logs desired. Must be `"silent"`, `"trace"`, `"debug"`, `"info"`, `"warn"`, `"error"`, or `"fatal"`. Default is `"info"`. The lower the level, the more verbose. |
| `destination` | String | Direct JSON logs to a file. Must be an absolute path. Default is `""` (no file output, only console).                                                                             |

## bot

| Config           | Type   | Description                                                                                                                                                                                         |
| ---------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`\*        | String | Bot token.                                                                                                                                                                                          |
| `redirectURI`\*  | String | Domain with `/authorize` appended after it. Make sure you add this exact URL to Redirects for your application at [Discord Developers](https://discordapp.com/developers/applications/), in OAuth2. |
| `clientID`\*     | String | Application ID retrieved from [Discord Developers](https://discordapp.com/developers/applications/).                                                                                                |
| `clientSecret`\* | String | Application secret retrieved from [Discord Developers](https://discordapp.com/developers/applications/).                                                                                            |

## database

| Config       | Type   | Description                                                                                                                                                                                                                                                  |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `uri`\*      | String | [MongoDB connection string](https://docs.mongodb.com/manual/reference/connection-string/). This **must** match the bot's database connection URI in order for the web control panel to have access to the same data. Default is `"mongodb://localhost/rss"`. |
| `connection` | Object | The [connection options object](http://mongoosejs.com/docs/connections.html#options) options passed through Mongoose. This can be used for other types of authentication.                                                                                    |
| `redis`\*    | String | Redis URI. Default is `""`. **All keys that match `drss*` will be deleted every time the web starts. Do not use a database or database index that contains keys used by oher applications that match the `drss*` pattern.**                                  |

## http

| Config          | Type    | Value                                       |
| --------------- | ------- | ------------------------------------------- |
| `trustProxy`    | Boolean | Enable reverse proxy support.               |
| `sessionSecret` | String  | Unique string to prevent session hijacking. |
| `port`          | Number  | HTTP port. Default is `8081`.               |

## https

| Config        | Type    | Value                                   |
| ------------- | ------- | --------------------------------------- |
| `enabled`     | Boolean | Enable Node.js's HTTPS server.          |
| `privateKey`  | String  | Absolute path to your private key file. |
| `certificate` | String  | Absolute path to your certificate file. |
| `chain`       | String  | Absolute path to your chain file.       |
| `port`        | Number  | HTTPS port. Default is `443`.           |


# Environment Variables

### Bot

All configs can be overridden with environment variables. Each variable must be prefixed with `DRSS`, and each depth is marked by an underscore `_`. All variables must also be capital. For example:

`config.database.uri`=`DRSS_DATABASE_URI`

`config.bot.token`=`DRSS_BOT_TOKEN`

For any configs that are arrays such as owner IDs, they are simply strings separated by commas. For example, `DRSS_BOT_OWNERIDS=123,456,789`.

### Web

The same rules apply, but instead of `DRSS` prefix, it's `DRSSWEB`. For example:

`config.database.uri`=`DRSSWEB_DATABASE_URI`

`config.bot.token`=`DRSSWEB_BOT_TOKEN`

A special env variable `DRSS_START` can be equal to `bot` to only start the bot,  `web` to only start the web, or `bot-web` to both bot and web with the `npm start` command.


# Discord Commands

{% hint style="warning" %}
**Each command must start with the prefix defined in your configuration. The default prefix is `rss.`. For example, `rss.add`, `rss.text`, etc.**
{% endhint %}

{% hint style="warning" %}
Message content intent must be enabled for the bot to read Discord messages aind respond to commands. This option can be found in Discord's control panel. See the image below.
{% endhint %}

<figure><img src="/files/pf1UkggT0nu4fkQdYG8k" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Commands have been disabled on the public bot because of [Discord's breaking permission changes](https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Access-Deprecation-for-Verified-Bots). All functions must be done either through the current control panel at <https://monitorss.xyz> or the newer one at <https://my.monitorss.xyz>
{% endhint %}

**Argument Definitions**

`*` - Add anything.

`content` - Add `content` after the command.

`(a|b|c)` - Select `a` or `b` or `c` and add it after the command.

`[content]` - Same as above, but optional.

`<content>` - Replace `content` with the information requested.

## Bot Owner Commands

Bot owners are specified through the config `ownerIDs` via user IDs. This is *only* for bot administrators/hosters to use - *not* server owners. See config for details.

| Command               | Arguments        | Description                                                                                                                                                                                                                                                                |     |                |           |                          |                                                         |                                                                |
| --------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | -------------- | --------- | ------------------------ | ------------------------------------------------------- | -------------------------------------------------------------- |
| setpresence           | <p>(online       | invisible                                                                                                                                                                                                                                                                  | dnd | idle) (PLAYING | STREAMING | LISTENING</p><p>WATCHING | CUSTOM\_STATUS) \<activity\_name> \[\<stream\_url>]</p> | Set to `null` to remove the presence. Rate limited by Discord. |
| setavatar             | \<url/file name> | Change the bot's avatar. Rate limited at 2 requests/10-15 min by Discord.                                                                                                                                                                                                  |     |                |           |                          |                                                         |                                                                |
| setusername           | \*               | ***USE SPARINGLY!*** Change the bot's username. Heavily rate limited at 2 requests/hour by Discord.                                                                                                                                                                        |     |                |           |                          |                                                         |                                                                |
| blacklist/unblacklist |                  | Have the bot ignore any commands from a certain guild and remove all feeds from the guild if any exists.                                                                                                                                                                   |     |                |           |                          |                                                         |                                                                |
| debug                 | \<feed ID>       | Show debug logs that track the request and response of every feed fetch as well as the comparison result of every database article against the articles in the feed from the response. This does not persist across reboots. To get the feed ID, use the `backup` command. |     |                |           |                          |                                                         |                                                                |
| undebug               | \<feed ID>       | Disable debug logs for a feed.                                                                                                                                                                                                                                             |     |                |           |                          |                                                         |                                                                |
| setstatus             |                  | Change the bot's status. Must be `"online"`, `"idle"`, `"invisible"`, or `"dnd"` (case sensitive).                                                                                                                                                                         |     |                |           |                          |                                                         |                                                                |
| restore               | \<guild id>      | Restore a guild's from an attached JSON file (created by the backup command). **You must attach the guild's JSON file alongside this command. Attach the file first, then type the command in the popup box.**                                                             |     |                |           |                          |                                                         |                                                                |
| kill                  |                  | Exit all processes with status code 1.                                                                                                                                                                                                                                     |     |                |           |                          |                                                         |                                                                |
| listguilds            |                  | Attach a file listing all the guilds the bot is in, sorted by number of members.                                                                                                                                                                                           |     |                |           |                          |                                                         |                                                                |

## Guild Manager Commands

For anyone with "Manage Channel" permission in the guild, or in a channel.

| Command         | Arguments                        | Description                                                                                                                                                                                                                                                                                                                 |
| --------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| add             |                                  | Add feeds for that specific channel. Can add multiple links separated by `>`.                                                                                                                                                                                                                                               |
| alert           | (add\|remove) \<user id/mention> | Specify users that should be notified when a feed has failed. Adding a user disables guild channel notifications.                                                                                                                                                                                                           |
| backup          |                                  | Backup the server's profile into an attached JSON file. To restore it, you must be a controller and use the `restore` owner command.                                                                                                                                                                                        |
| clone           |                                  | Clone a feed's settings to other feed(s).                                                                                                                                                                                                                                                                                   |
| compare         | \<properties>                    | Add n/p-comparisons to a feed.                                                                                                                                                                                                                                                                                              |
| date            |                                  | Opens a menu for date/timezone customizations only applicable if `{date}` placeholders are used.                                                                                                                                                                                                                            |
| dump            |                                  | Opens a menu to send a text file showing the available raw placeholders of a feed for use.                                                                                                                                                                                                                                  |
| embed           |                                  | Opens a menu to set embed properties to be sent in addition to its regular text.                                                                                                                                                                                                                                            |
| embed.fields    |                                  | Opens a menu to control fields with your embed(s).                                                                                                                                                                                                                                                                          |
| filters         |                                  | Opens a menu to add or remove filters for specific categories for a feed.                                                                                                                                                                                                                                                   |
| help            |                                  | List all the commands.                                                                                                                                                                                                                                                                                                      |
| invite          |                                  | Show the invite links for the bot.                                                                                                                                                                                                                                                                                          |
| list            | \[\<channel mention>] \[query]   | Show the list of feeds in all guild channels. Optionally add a channel mention and/or a search query.                                                                                                                                                                                                                       |
| locale          | \<locale>                        | Change the language text of commands if the language is available.                                                                                                                                                                                                                                                          |
| mention         |                                  | Opens a menu to set either user or role subscribers to be mentioned for new articles of a feed is posted.                                                                                                                                                                                                                   |
| mention.filters |                                  | Opens a menu to manage filters for subscribers so they only get mentioned when its filters pass for any particular delivered article.                                                                                                                                                                                       |
| move            |                                  | Move a feed to another channel.                                                                                                                                                                                                                                                                                             |
| options         |                                  | Opens a menu for miscellaneous feed options.                                                                                                                                                                                                                                                                                |
| prefix          |                                  | Specify a guild-specific prefix to use for commands.                                                                                                                                                                                                                                                                        |
| refresh         |                                  | Make a connection attempts for a feeds to be readded to their respective cycles if they failed (`config.feeds.hoursUntilFail`)                                                                                                                                                                                              |
| remove          |                                  | Opens a menu to remove feeds.                                                                                                                                                                                                                                                                                               |
| split           |                                  | Open a menu to customize message splitting settings for messages that exceed the character limit.                                                                                                                                                                                                                           |
| stats           |                                  | Show performance information/general stats on the bot gathered during its lifetime.                                                                                                                                                                                                                                         |
| test            | \[simple] \[latest]              | Opens a menu to print out the properties for a specific RSS feed and its filter status on whether it passed (if filters exist), along with a randomly chosen feed of any age - in the defined message/embed format in config.json. Add `simple` to exclude test details, and/or `latest` to try and get the latest article. |
| text            |                                  | Opens a menu to set the custom text message of the feed that will be sent.                                                                                                                                                                                                                                                  |
| version         |                                  | Show the current version of the bot                                                                                                                                                                                                                                                                                         |
| webhook         |                                  | Assign a webhook to send articles instead of the bot for a feed in a particular channel.                                                                                                                                                                                                                                    |

## User Commands

Usable by anyone in guild.

| Command     | Arguments | Description                                                                                                                          |
| ----------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| sub         |           | Enabled/disabled by "Manage Roles" permission. Shows a list of feeds with their roles¹ that can be added to the user.                |
| sub.filters |           | Manage filters applied to the user as a direct subscriber of a particular feed.                                                      |
| unsub       |           | Enabled/disabled by "Manage Roles" permission. Shows a list of feeds with their respective roles² that can be removed from the user. |

{% hint style="info" %}
¹Roles that are *beneath* the bot's role order (handled in role settings), and are subscribed to feeds.

²Roles that are *beneath* the bot's role order (handled in role settings).
{% endhint %}


# MongoDB vs Databaseless

MongoDB is the database used to store persistent data such as guild data, feeds, old articles (for comparisons to see what is old and new) and blacklists.

Databaseless is when no database is used - allowing the bot to be deployed quicker with no database dependency, but at the expense of some features.

## The Differences

The differences are summarized below - otherwise, they are identical.

### MongoDB

Used by setting a [MongoDB URI](https://docs.mongodb.com/manual/reference/connection-string/) in [`config.database.uri`](https://github.com/synzen/Discord.RSS/wiki/Configuration), or if you're using Docker, the env variable `DRSS_DATABASE_URI`.

* Data stored in database
* Articles missing during bot downtime are delivered upon next startup

### Databaseless

Used by setting a folder path in [`config.database.uri`](https://github.com/synzen/Discord.RSS/wiki/Configuration), or if you're using Docker, the env variable `DRSS_DATABASE_URI`. Both relative and absolute paths are accepted. For example, `"./drss"` or `"/data/drss"`.

* Web interface is unavailable
* Data is stored as JSON files
* Articles missed during bot downtime are not delivered
* Destabilizes after thousands of JSON files
* Web interface is not supported
* Statistics as seen in the `stats` command
* The following configs have no effect:
  * `config.database.connection`
  * `config.database.articlesExpire`
  * `config.database.deliveryRecordsExpire`
  * `config.feeds.sendOldOnFirstCycle`
  * `config.feeds.cycleMaxAge`
  * `config.feeds.articleDailyChannelLimit`

**Memory use will increase during the bot's lifetime as more articles are sent since they are stored in memory for reference to decide whether future articles are new or old.**

## What should I use?

MongoDB as originally intended. However, because MongoDB only officially supports 64-bit OS, databaseless may be your only choice if your system is not 64-bit.


# Placeholders

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Placeholders are phrases in the feed's content that are replaced during feed parsing from the source to your Discord, which varies from feed to feed and article to article. They are usable in custom text/embeds wherever.

Placeholders can be found with the `test` command.

## Placeholders

| Placeholder                     | Description                                                                                                                                                                                      |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| {title}                         | Title of the article.                                                                                                                                                                            |
| {author}                        | Author of the article.                                                                                                                                                                           |
| {description}                   | Definition of "Description" varies from feed to feed.                                                                                                                                            |
| {summary}                       | Definition of "Summary" varies from feed to feed.                                                                                                                                                |
| {link}                          | Link to the article.                                                                                                                                                                             |
| {image\<number>}                | The number is replaced with a number 1-9. Sometimes feed image(s) are available - they will be shown with the `test` command.                                                                    |
| {date}                          | The published date of the article. Timezone can be [customized](https://github.com/synzen/Discord.RSS/wiki/Timezone), as well as its format in config.                                           |
| {\<placeholder>:image\<number>} | The number is replaced with a number from 1-5. These are images found within title, summary, and/or the description of its article. Replace placeholder with title, summary, or description.     |
| {empty}                         | A special placeholder that can be used in a feed's custom text to make it blank, but *only* if an embed is used. If there is no embed, then the message will revert back to the default message. |

Putting placeholders will add the article's respective information into the text. This can either be in the main message, or in the embed.

### Raw Placeholders

Sometimes a built in placeholder is not enough. You can use raw data from the XML if it can be parsed appropriately by finding such placeholders with the `dump` command. It can then be used anywhere by prepending `raw:` to the placeholder name, including filters.

## Image Fallback

Sometimes `{image<number>}` or `{<placeholder>:image<number>}` may not exist for some articles. In that case, you may provide image fallbacks - images that will replace the nonexistent image. To define image fallbacks, it is in the format of `{image4||image3||image2||image1||http://whatever.com/myfallbackimg.jpg}`. Fallback images can be a `{<placeholder>:image<number>}`, a `{image<number>}`, or a direct image link.&#x20;

1. Direct image links cannot be used as the main image (left most position). Direct image links should ideally be used in the last position so there's always an image to fall back to.
2. Image numbers should be decreasing from left to right. For example `{image1||image2}` does not make sense because if image1 doesn't exist, then image2 doesn't exist either. It should be `{image2||image1}`.

## Blank Lines

If you want to intentionally add a blank line without Discord automatically removing it, you can put the text`\u200b`.


# Text

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

The main message of the feed can be edited through Discord with the command `text`. Regular [Markdown formatting](https://support.discordapp.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-) is possible wherever Discord allows, and of course placeholder use is supported.

`"{date}\nA new feed has arrived!\n\n**{title}**\n{description}"`

If you want to add links to your feed but do not want the embed that Discord creates, such as the one in the image below:&#x20;

![](https://camo.githubusercontent.com/2a06814644dfa5390ff2bdffc60dbf6b3d59cc15/687474703a2f2f692e696d6775722e636f6d2f514474656b314e2e706e67)

Add `<` and `>` around your link. This also applies for use with placeholders (for example, `<{link}>` ).

## Format

{% code title="Feed" %}

```javascript
{
    "title": "some title",
    "url": "http://somewebsite.com/rss/",
    "channel": "12345",
    "text": "My Message here!"
}
```

{% endcode %}


# Embed

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Embeds are those fancy Discord messages with a box and text inside it - something that can't be sent via regular messaging. To customize the embed, use the `embed` command.

Discord automatically creates an embed for links, such as the one below:

![](/files/-Lyw57RB4weNVcBBLV7N)

and bots can create their own:

![](/files/-Lyw5-7Hw7vo0IZ8Pwh_)

An embed can normally contain [many items](https://cdn.discordapp.com/attachments/84319995256905728/252292324967710721/embed.png). The embed properties that can be customized for a feed are listed below.

| Property            | Description                                                                                |
| ------------------- | ------------------------------------------------------------------------------------------ |
| Color               | Sidebar color. Must be in [integer format](http://www.shodor.org/stella2java/rgbint.html). |
| Author Title        | Title at the top.                                                                          |
| Author URL          | Clicking on the Author Title will lead to this URL.                                        |
| Author Avatar URL   | Avatar icon to the left of Author Title. This will only be shown if Author Title is set.   |
| Title               | Title under Author Title.                                                                  |
| Thumbnail Image URL | Image on the right side.                                                                   |
| URL                 | Clicking on the Title/Thumbnail will lead to this URL.                                     |
| Image URL           | Image on the bottom.                                                                       |
| Message             | Main message.                                                                              |
| Footer Text         | Bottom-most text.                                                                          |
| Footer Icon URL     | Icon to the left of Footer Text.                                                           |
| Timestamp           | Date that is visually localized to every user.                                             |

**Adding an embed will override the embed that Discord normally sends with links (see first image)**

### Fields

![](https://i.imgur.com/6oC5W7h.png)

To add embed fields, use the command `embed.fields`. All placeholders are valid in fields as well.


# Filters

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Filters can be added to control what feeds get sent to Discord via the command `filters`. There are five categories for which filters can be applied to: title, description, summary, author and tag.

{% hint style="warning" %}
Categories are set by the feed author, and not by you. Setting a filter to a category that does not exist or is not identified by the `test` command will cause all articles of the feed to fail the filter.
{% endhint %}

There are two types of filters: regular or regex. If regex filters are defined, regular filters will be ignored.

#### Filters on Other Article/XML Properties

You can apply filters to non-standard raw properties. Use the `dump` command, find the relevant name, and use `raw:<name>` as the filter category (replacing `<name>` with the name in the dump output).

##


# Regular

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Regular filters "OR" filters, and are *case insensitive*. This meaning that if *any* of the words defined in the filters are found in the feed in their respective categories, then it will pass the filter and be sent to Discord.

{% hint style="warning" %}
If regex filters are defined, regular filters will be ignored
{% endhint %}

## Format

{% code title="Feed" %}

```javascript
{
    "filters": {
        "title": ["filter1", "filter2"],
        "description": ["word1"]
    }
}
```

{% endcode %}

## Modifiers

Add modifiers in front of words to change their behavior.

`~` - Broad modifier where if the word is found *anywhere* in the property it will pass (including inside words). Use `\~` to escape the tilde.

`!` - NOT modifier to negate what it normally does, and is essentially a blacklist. This will take priority over everything. Like the broad search, you may escape it by `\!` to interpret it as a normal exclamation mark.

`!~` - The negation of the broad modifier.

## Examples

Example filter words and their respective example contents to be searched for the filters are found below. BLOCKED means the article won't be sent with that content for that filter.

### Filter: `test`

"Testing here" - BLOCKED

"Protest" - BLOCKED

"Test Me" - PASSED

### Filter: `~test`

"Testing here" - PASSED

"Protest" - PASSED

"Test Me" - PASSED

### Filter: `!test`

"Testing here" - PASSED

"Protest" - PASSED

"Test Me" - BLOCKED

### Filter: `!~test`

"Testing here" - BLOCKED

"Protest" - BLOCKED

"Test Me" - BLOCKED

### Filters: `test`, `another`

"Testing here" - BLOCKED

"Protest Another" - PASSED

"Test Me" - PASSED

### Filters: `!test`, `~her`

"Her Message" - PASSED

"Her Test" - BLOCKED

"Test Her" - BLOCKED

"Test Me" - BLOCKED


# Regex

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

\
Regex filters can be defined with the "rfilters" key via manual editing. Remember to escape backslashes by using double backslashes.

{% hint style="warning" %}
If regex filters are defined, regular filters will be ignored
{% endhint %}

## Format

{% code title="Feed" %}

```javascript
{
    "rfilters": {
        "title": "\\d+",
        "description": "apples"
    }
}
```

{% endcode %}


# Subscribers

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Subscribers are users or roles that are mentioned when a new article has arrived. Subscribers can also have filters attached to them so they're only mentioned when certain articles pass their respective filters. To add new subscribers, use the `mention` comand.

Regular users can add subscribed roles to themselves with the `sub` command. Regular users can also remove subscribed roles from themselves with the `unsub` command.

{% hint style="warning" %}
For the role mentions to show up on messages, the placeholder `{subscriptions}` must be used.
{% endhint %}

## Format

{% tabs %}
{% tab title="Role Subscriber" %}
{% code title="Subscriber" %}

```javascript
{
    "feed": ObjectId("feedid"),
    "type": "role",
    "id": "<role id here>"

}
```

{% endcode %}
{% endtab %}

{% tab title="User Subscriber" %}
{% code title="Subscriber" %}

```javascript
{
    "feed": ObjectId("feedid"),
    "type": "user" ,
    "id": "<user id here>"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Filters

The same filter format as feed filters are used (both regular and regex).

{% tabs %}
{% tab title="Regular Filters" %}
{% code title="Subscriber" %}

```javascript
{
    "feed": ObjectId("feedid"),
    "type": "role" ,
    "id": "<role id here>",
    "filters": {
        "title": ["hello"]
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Regex Filters" %}
{% code title="Subscriber" %}

```javascript
{
    "feed": ObjectId("feedid"),
    "type": "role" ,
    "id": "<role id here>",
    "rfilters": {
        "title": "\d+"
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


# Dates and Timezone

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Various date settings can be customized to tailor the `{date}` placeholder to show what you want. Date settings are server-wide, so they cannot be changed to be different for each feed. Use the `date` command to customize date settings.

## Timezone

Valid timezones are found at <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones> in the "TZ database name" column .

#### Format

{% code title="Feed" %}

```javascript
{
    "timezone": "UTC"
}
```

{% endcode %}

## Date Format

Format structure information is found at <https://momentjs.com/docs/#/displaying/>.

#### Format

{% code title="Feed" %}

```javascript
{
    "datFormat": "dddd, MMMM Do YYYY, h:mm:ss a"
}
```

{% endcode %}

## Date Language

Date languages must first be specified in `config.feeds.dateLanguageList` before they are accessible via commands. This is to avoid loading in all the possible languages when most of them are not needed.

#### Format

{% code title="Feed" %}

```javascript
{
    "dateLanguage": "UTC"
}
```

{% endcode %}


# Webhooks

{% hint style="warning" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Webhooks are basically custom bots anyone can create within 10 seconds with a custom avatar and username that the bot can redirect feed articles to so the bot won't be directly be sending messages! An example of what it can do:

![Webhook Example](/files/-M8cx-gbHQeHAPiww-Kj)

Note that webhooks can only operate in the channel they are authorized to. Each webhook is specific to a particular feed. To first add a webhook:

1. Go to the feed's Discord channel, and **Edit Channel**
2. Click **Webhooks**
3. Create a new one.

Then to integrate this webhook with the bot, use the command `webhook` in the same channel.

Parameters can be added to `webhook` as `--username="my custom name"` and/or `--avatar="my avatar URL"` to change the username/avatar of the webhook for that particular feed. Placeholders are also accepted here!

{% hint style="info" %}
If you change the name or avatar of the webhook, the bot will not see the changes unless you use the command `webhook` and overwrite the old one in memory, or restart the bot.
{% endhint %}

## Format

{% code title="Feed" %}

```javascript
{
    "webhook": {
        "id": "123",
        "name": "some name",
        "avatar": "https://www.website.com/image.jpg"
    }
}
```

{% endcode %}


# Custom Comparisons

{% hint style="danger" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Custom Comparisons are additional checks after the default algorithm determines whether an article is new or old. They can be accessed by the `compare` command. Properties on the original article object are used. To get the original properties, use the `dump` command with the `original` argument. For nested keys, separate them with `_`.

All comparison keys are from the original feed object, which can be accessed through the `rss.dump original` command. If the values are not pure strings, they will get ignored (this includes dates).

To remove all settings, add the `reset` argument, for example `rss.compare reset`.

## Blocking Comparisons

"blocking" comparisons will check additional article properties to attempt to block an article from sending after default algorithms mark an article as new.

An example use case is when you don't want articles with the same title to send.

## Passing Comparisons

"passing" comparisons will check additional article properties to attempt to pass an article for it to send after default algorithms mark an article as old.

An example use case is when you want the same article that frequently changes description to repeatedly send.

{% hint style="danger" %}
If date checks are turned on, an article that passes p-comparisons will still be blocked if it is marked old via date checks.
{% endhint %}

## Format

{% code title="Feed" %}

```javascript
{
    "title" : "some title", 
    "url" : "https://somefeed.com/feed.xml", 
    "channel" : "12345", 
    "text" : "📰  |  **{title}**\n\n{description}\n\n{subscriptions}",
    "pcomparisons" : [
        "description"
    ],
    "ncomparisons": [
        "title"
    ]
}

```

{% endcode %}

## Example

Assume `dump original` gives the file contents:

```javascript
[
  {
    "title": "[Monitor] Samsung Odyssey G5-34\" UWQHD 3440x1440 165hz 1ms VA-($599.99-$50.00)$549.99",
    "description": "<table> <tr><td> <a href=\"https://www.reddit.com/r/buildapcsales/comments/ldz9yg/monitor_samsung_odyssey_g534_uwqhd_3440x1440/\"> <img src=\"https://b.thumbs.redditmedia.com/ynjnniuznA1nN7hZHSSU3jRzTRcE8E1JifDtXWUNWPA.jpg\" alt=\"[Monitor] Samsung Odyssey G5-34&quot; UWQHD 3440x1440 165hz 1ms VA-($599.99-$50.00)$549.99\" title=\"[Monitor] Samsung Odyssey G5-34&quot; UWQHD 3440x1440 165hz 1ms VA-($599.99-$50.00)$549.99\" /> </a> </td><td> &#32; submitted by &#32; <a href=\"https://www.reddit.com/user/SenorSalsa\"> /u/SenorSalsa </a> <br/> <span><a href=\"https://www.bestbuy.com/site/samsung-g5-odyssey-34-curved-gaming-monitor-with-165hz-refresh-rate-black/6445082.p?skuId=6445082\">[link]</a></span> &#32; <span><a href=\"https://www.reddit.com/r/buildapcsales/comments/ldz9yg/monitor_samsung_odyssey_g534_uwqhd_3440x1440/\">[comments]</a></span> </td></tr></table>",
    "summary": null,
    "date": "2021-02-06T15:03:27.000Z",
    "pubdate": "2021-02-06T15:03:27.000Z",
    "pubDate": "2021-02-06T15:03:27.000Z",
    "link": "https://www.reddit.com/r/buildapcsales/comments/ldz9yg/monitor_samsung_odyssey_g534_uwqhd_3440x1440/",
    "guid": "t3_ldz9yg",
    "author": "/u/SenorSalsa",
    "comments": null,
    "origlink": null,
    "image": {
      "url": "https://b.thumbs.redditmedia.com/ynjnniuznA1nN7hZHSSU3jRzTRcE8E1JifDtXWUNWPA.jpg"
    }
  }
]
```

The first object is an example of an article object.

If you'd like the article to be delivered whenever the `image.url` changes for any article, the command would be `rss.compare +image_url`.

If you'd like the article to be delivered whenever the *both* the `image.url` and the `author` changes, the command would be `rss.compare +image_url +author`.

If you'd like articles to be blocked if a title was already posted by another article, the command would be `compare -title`.

If you'd like articles to be blocked if either the `title` *or* the `guid` was posted by another article, the command would be `compare -title -guid`.

You can mix `+` and `-` as much as you'd like.


# Filtered Message Formats

{% hint style="danger" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

With filtered formats, you're able to set specific message/embed formats to specially specified filters. They must be added via manual editing. For example, if you have a feed that tracks all the replies in a forum thread, you're able to set filters that can select certain replies and set a separate message format for them.&#x20;

To show an example, we'll use an example `Feed` with a particular ID:

{% code title="Feed" %}

```javascript
{
    _id: ObjectId("abc123"),
    text: "A casual person has replied on this thread"
    // ...other properties
}
```

{% endcode %}

The format to specify filtered formats for the above feed is as follows:

{% code title="FilteredFormat" %}

```javascript
{
    "feed": ObjectId("abc123"),
    "filters" : {
        "author" : [
            "SomeImportantPersonsName"
        ]
    }, 
    "text" : "Begone casuals! A very important person has replied!",
    "embeds": [{
        "title": "Alert!"
    }]
}
```

{% endcode %}

In the above example, a forum post will normally use the text set for that feed ("A casual person has replied on this thread"). But if SomeImportantPersonsName suddenly replies, the `text` and `embeds` for the `FilteredFormat` will replace the feed's text and/or embeds.

* If `embeds` is undefined in a filtered format, it will use the feed's embeds. If the feed's embeds is undefined, then no embed will be shown.
* If `text` is undefined in a filtered format, it will use the feed's text. If the feed's text is undefined,`config.feeds.defaultText` will be used.

### Resolving Multiple Filter Matches with Priorities

{% tabs %}
{% tab title="Filtered Format (Priority 2)" %}
{% code title="FilteredFormat" %}

```javascript
{
    "feed": ObjectId("abc123"),
    "priority": 2,
    "filters" : {
        "author" : [
            "~ImportantPersonsName"
        ]
    }, 
    "text" : "Another important person has replied!"
}
```

{% endcode %}
{% endtab %}

{% tab title="Filtered Format (Priority 3)" %}
{% code title="FilteredFormat" %}

```javascript
{
    "feed": ObjectId("abc123"),
    "priority": 3,
    "filters" : {
        "author" : [
            "SomeImportantPersonsName"
        ]
    }, 
    "text" : "Begone casuals! A very important person has replied!",
    "embeds": [{
        "title": "Alert!"
    }]
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

Note that the second filtered format may conflict with the first one, resulting in the filters for both filtered formats passing. To resolve this, you should set a `priority` number greater than or equal to 0. In this case, since the first format has a higher priority, the first format will be selected.

If no priorities are set and more than one filtered format is matched, it will use none of the filtered formats and instead fall back to either feed's message if it exists or `config.feeds.defaultText`.

{% hint style="info" %}
A `FilteredFormat` with no priority has a default priority of 0
{% endhint %}


# Custom Regex Placeholders

{% hint style="danger" %}
**This documentation site is deprecated. Please visit the control panel at** [**https://monitorss.xyz** ](https://monitorss.xyz)**for all up-to-date functionality**
{% endhint %}

Regular Expressions (regex) is used to find, modify, and replace content. Suppose you want to remove/modify specific text. Or you want to remove some copyright text or whatever. Regex can do this.

All regex is applied *after* the text is internally sanitized/filtered, and *before* it is truncated (if necessary). The content you see through a test message (with \[Filters Passed]: Yes) is the most accurate depiction of what your regex will be working on (content might be truncated in the test however).

## Recommendation

Before applying any regexOps, you should first test your expressions and replacements at <https://regex101.com/>. Brute-testing regex can be quite frustrating without trying it first.

## Usage/Syntax

Regex cannot be specified via Discord commands - you will have to modify your feed JSON to do so. Each regexOp object has a `name` key, where you will then refer to it in Discord as {placeholder:myName} where myName would be the value of the key. The placeholder can be any valid placeholder found in the command output of `test` for a feed. Ex: {title:SpecialName}.

The object "regexOps" is added to a *feed object*, and the outline is this:

{% code title="Feed" %}

```javascript
{
    "url": "whatever.com",
    "channel": "1234",
    "regexOps": {
      "placeholder": [{
        "name": "whatever",
        "search": {
            "flags": "gi",
            "regex": "(?:\r\n|\r|\n)",
            "match": 0,
            "group": 0
        },
        "replacement": ""
      }]
    }
}
```

{% endcode %}

* *Required* `"placeholder"` - Replace `placeholder` with any placeholder such as description, title, etc..
* *Required* `"name"` - Reference to what the custom placeholder will be named. If there is no name, the regexOp in question will be ignored. For example in the snippet above, it would be referred to as {placeholder:whatever}.
* *Required* `"search"` - The value should be an object of the following keys:
  * *Required* `"regex"` - Your regex expression.
  * *Optional* `"match"` - Match number (not string) from your regex expression. Defaults to `0`. Note that the first match is **0** and not **1**.
  * *Optional* `"group"` - Group number (not string) of the selected match from your regex expression. Defaults to `0` (the full match).
  * *Optional* `"flags"` - Javascript [regex flags](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Advanced_searching_with_flags). Defaults to `"gi"`
* *Optional* `"replacement"` - A replacement string value that will replace all instances of the search in the original string.
* *Optional* `"replacementDirect"` - Directly input your own regex into the second argument of `.search` function for a replacement. This will override the `replacement` key.

**If the `replacement` key is undefined (meaning the key does not exist), then your custom placeholder will return your search results.**

**If the `replacement` is defined, then your custom placeholder will return the original placeholder content with all instances of the search results replaced by your `replacement` string.**

## Chained Regex

More than one regexOp can be added for a placeholder by simply adding another regexOp object:

{% code title="Feed" %}

```javascript
"regexOps": {
    "placeholder": [{
        "name": "whatever",
        "search": {
            "regex": "(?:\r\n|\r|\n)",
            "flags": "g"
        },
        "replacement": "\n(This will replace all new lines)"
    },{
        "name": "whatever",
        "search": {
            "regex": "^.*",
            "flags": "g"
        },
        "replacement": "This sentence will replace everything from the previous regexOp because of the ^.* search term (and because it has the same name)!"
    }]
}
```

{% endcode %}

**The order and name matters!** Named regexOps are executed from top to bottom.

## Disabling

You can temporarily disable all regexOps, add the `"disabled"` key:

{% code title="Feed" %}

```javascript
"regexOps": {
    "disabled": true,
    "title": [{
        "name": "whatever",
        "search": {
            "regex": "(?:\r\n|\r|\n)",
            "flags": "gi"
        },
        "replacement": ""
    }],
    "description": [{
        "name": "whatever",
        "search": {
            "regex": "(?:\r\n|\r|\n)",
            "flags": "g"
        },
        "replacement": ""
    },{
        "disabled": true,
        "name": "whatever",
        "search": {
            "regex": "(?:\r\n|\r|\n)",
            "flags": "g"
        },
        "replacement": ""
    }]
}
```

{% endcode %}

To disable multiple placeholders instead of disabling all regexOps, replace `"disabled"` boolean value with an array of whatever placeholders you want disabled: `"disabled": ["description", "title"]` or `"disabled": ["title"]`

You can also disable a specific regexOp by adding `"disabled": true` as well.

## Errors

Regex errors will by default be shown for articles that the regex can't find a match for. To disable visible errors, change `config.feeds.showRegexErrs` to false.


