PluralKit/dev-docs/dotnet.md

39 lines
9 KiB
Markdown

## Configuration
Configuration was previously done through a JSON configuration file `pluralkit.conf` placed in the bot's working directory. To simplify things however and maintain consistency with the Rust services, it is now recommended to use environment variables.
The minimum configuration needed for the dotnet part of the bot to function include the following:
- **`PluralKit__Bot__Token`**: the Discord bot token to connect with
- **`PluralKit__Bot__ClientId`**: the ID of the bot's user account, used for calculating the bot's own permissions and for the link in `pk;invite`
- **`PluralKit__Database`**: the URI of the PostgreSQL database to connect to (in [ADO.NET Npgsql format](https://www.connectionstrings.com/npgsql/))
- **`PluralKit__RedisAddr`**: the `host:port` of the Redis database to connect to
**When using Nix, the Database URI Username, Password, and Database fields must match what the database was setup with in the `flake.nix` file!**
### Available Configuration Values:
| Name | Description | Rust Equivalent (if applicable) |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- |
| **`PluralKit__Api__ClientId`** | the ID of the bot's user account, used for OAuth with Discord | *`pluralkit__discord__client_id`* |
| **`PluralKit__Api__ClientSecret`** | the client secret of the application, used for OAuth with Discord | *`pluralkit__discord__client_secret`* |
| **`PluralKit__Api__TrustAuth`** | boolean used to determine if the API should trust upstream to provide it the system id of the authenticated user | |
| **`PluralKit__Bot__AdminRole`** | Discord role ID used to determine if a user can use `pk;admin` commands | |
| **`PluralKit__Bot__AvatarServiceUrl`** | the URL of the avatar service | |
| **`PluralKit__Bot__ClientId`** | the ID of the bot's user account, used for calculating the bot's own permissions and for the link in `pk;invite`. | *`pluralkit__discord__client_id`* |
| **`PluralKit__Bot__Cluster__TotalShards`** | the total number of shards | *`pluralkit__discord__cluster__total_shards`* |
| **`PluralKit__Bot__DisableGateway`** | (deprecated) boolean used to enable or disable the inbuilt gateway functions, should be true if using Rust `gateway` | |
| **`PluralKit__Bot__DiscordBaseUrl`** | the base Discord API url used for HTTP API requests | *`pluralkit__discord__api_base_url`* |
| **`PluralKit__Bot__EventAwaiterTarget`** | the target bind address used to receive bot-instance specific events (such as interactive prompts/menus) from `gateway` over http -- value should generally be `source-addr`. | |
| **`PluralKit__Bot__HttpCacheUrl`** | the URL of the http cache to use, as of now, the `gateway` service | |
| **`PluralKit__Bot__HttpListenerAddr`** | the base bind address (use `allv4v6` instead of `::` if you want to also bind to `0.0.0.0`) | |
| **`PluralKit__Bot__Token`** | the Discord bot token to connect with | *`pluralkit__discord__bot_token`* |
| **`PluralKit__Database`** | the URI of the database to connect to (in [ADO.NET Npgsql format](https://www.connectionstrings.com/npgsql/)) | *`pluralkit__db__data_db_uri`* (diff formatting) |
| **`PluralKit__MessagesDatabase`** | the URI of the database for message storage to connect to (in [ADO.NET Npgsql format](https://www.connectionstrings.com/npgsql/)) | *`pluralkit__db__messages_db_uri`* (diff formatting) |
| **`PluralKit__RedisAddr`** | the `host:port` of a Redis database to connect to | *`pluralkit__db__data_redis_addr`* (diff formatting) |
| **`PluralKit__DispatchProxyToken`** | the token used to authenticate with the dispatch proxy service | |
| **`PluralKit__DispatchProxyUrl`** | the URL of the dispatch proxy service | |
| **`PluralKit__ConsoleLogLevel`** | the minimum [log level](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=net-9.0-pp) used for logging | |
| **`PluralKit__InfluxUrl`** | the URL to an [InfluxDB](https://www.influxdata.com/products/influxdb-overview/) server to report aggregate statistics to. An example of these stats can be seen on [the public stats page](https://stats.pluralkit.me). | |
| **`PluralKit__InfluxDb`** | the name of an InfluxDB database to report statistics to. If either this field or `PluralKit.InfluxUrl` are absent, InfluxDB reporting will be disabled. | |
| **`PluralKit__SentryUrl`** | the [Sentry](https://sentry.io/welcome/) client key/DSN to report runtime errors to. If absent, disables Sentry integration. | |
| **`PluralKit__Bot__Prefixes__0`** | A custom prefix to use instead of `pk;`, add additional entries replacing 0 with n for more prefixes | *`pluralkit__discord__bot_prefix_for_gateway`* (only first) |