# 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.md) for more info on programmatically). Configs can also be set via [environment variables](/configuration/environment-variables.md).

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.md) 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.md).                                                                                                                       |
| `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.md). 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.md). 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.monitorss.xyz/configuration/bot-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
