Go to file
2022-06-13 15:23:13 -04:00
.github fix: use correct path definition in github actions files 2022-06-05 13:50:52 -04:00
dashboard fix(dashboard): correct birthday validation on member creation 2022-06-07 19:05:40 +02:00
docs fix(docs): slightly clarify system command targeting (#462) 2022-06-12 05:10:38 +00:00
gateway chore(gateway): update Cargo.lock 2022-05-25 04:39:33 -04:00
Myriad chore: update github repo URL 2022-06-05 12:57:10 -04:00
myriad_rs chore: bump twilight version 2022-05-11 22:37:19 -04:00
PluralKit.API fix(api): return updated switch in PATCH /switches/:id 2022-06-11 17:16:53 -04:00
PluralKit.Bot fix: show correct error in 'pk;debug proxy' when autoproxy is disabled for discord account 2022-06-13 14:52:07 -04:00
PluralKit.Core feat: allow specifying database password in separate config parameter 2022-06-13 15:23:13 -04:00
PluralKit.ScheduledTasks chore: code cleanup (mostly whitespace / remove unused imports) 2022-03-30 04:36:22 -04:00
PluralKit.Tests feat(bot): add Redis cache 2022-04-13 08:44:53 -04:00
proto feat(bot): add Redis cache 2022-04-13 08:44:53 -04:00
scripts fix: generic-ify mgmt API URL in run-clustered.sh 2022-04-20 10:44:43 -04:00
.dockerignore feat(dashboard): add opengraph/oembed, Docker build 2022-06-03 01:01:54 -04:00
.editorconfig feat: upgrade to .NET 6, refactor everything 2021-11-26 21:10:56 -05:00
.gitignore chore: remove unused files from repo 2022-06-11 00:46:37 -04:00
.gitmodules Replace Discord.Net with DSharpPlus 2020-04-17 18:38:12 +02:00
BRANCHRENAME.md master branch was deleted, update docs accordingly 2020-07-28 19:43:52 +02:00
docker-compose.yml feat: add Redis identify ratelimiter 2022-01-13 12:26:25 -05:00
Dockerfile chore: update github repo URL 2022-06-05 12:57:10 -04:00
Dockerfile.dashboard fix(dashboard): correctly set current git commit hash during build 2022-06-05 11:33:02 -04:00
Dockerfile.gateway feat(gateway): split off cache into separate package, rename package to 'gateway' 2022-05-10 07:04:33 -04:00
LEGACYMIGRATE.md Move legacy migration docs to a separate file and reword 2020-07-28 19:41:17 +02:00
netlify.toml Fix build directory reference in netlify.toml 2020-07-28 18:24:07 +02:00
pluralkit.conf.example Actually add the example config file 2019-07-01 01:16:44 +02:00
PluralKit.sln feat: move scheduled tasks to separate project 2021-10-15 06:27:38 -04:00
README.md chore: update github repo URL 2022-06-05 12:57:10 -04:00

PluralKit

PluralKit is a Discord bot meant for plural communities. It has features like message proxying through webhooks, switch tracking, system and member profiles, and more.

Do you just want to add PluralKit to your server? If so, you don't need any of this. Use the bot's invite link: https://discord.com/oauth2/authorize?client_id=466378653216014359&scope=bot%20applications.commands&permissions=536995904

PluralKit has a Discord server for support, feedback, and discussion: https://discord.gg/PczBt78

Requirements

Running the bot requires .NET 5 and a PostgreSQL database. It should function on any system where the prerequisites are set up (including Windows).

Optionally, it can integrate with Sentry for error reporting and InfluxDB for aggregate statistics.

Configuration

Configuring the bot is done through a JSON configuration file. An example of the configuration format can be seen in pluralkit.conf.example. The configuration file needs to be placed in the bot's working directory (usually the repository root) and must be called pluralkit.conf.

The configuration file is in JSON format (albeit with a .conf extension). The following keys are available (using . to indicate a nested object level), bolded key names are required:

  • PluralKit.Bot.Token: the Discord bot token to connect with
  • PluralKit.Database: the URI of the database to connect to (in ADO.NET Npgsql format)
  • PluralKit.Bot.Prefixes: an array of command prefixes to use (default ["pk;", "pk!"]).
  • PluralKit.Bot.ClientId (optional): the ID of the bot's user account, used when generating invite links through pk;invite. It's automatically determined if not present, but overriding it may be useful for private instances that still want a public invite link.
  • PluralKit.SentryUrl (optional): the Sentry client key/DSN to report runtime errors to. If absent, disables Sentry integration.
  • PluralKit.InfluxUrl (optional): the URL to an InfluxDB server to report aggregate statistics to. An example of these stats can be seen on the public stats page.
  • PluralKit.InfluxDb (optional): 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.LogDir (optional): the directory to save information and error logs to. If left blank, will default to logs/ in the current working directory.

The bot can also take configuration from environment variables, which will override the values read from the file. Here, use : (colon) or __ (double underscore) as a level separator (eg. export PluralKit__Bot__Token=foobar123) as per ASP.NET config.

Running

Docker

The easiest way to get the bot running is with Docker. The repository contains a docker-compose.yml file ready to use.

  • Clone this repository: git clone https://github.com/PluralKit/PluralKit
  • Create a pluralkit.conf file in the same directory as docker-compose.yml containing at least a PluralKit.Bot.Token field
    • (PluralKit.Database is overridden in docker-compose.yml to point to the Postgres container)
  • Build the bot: docker-compose build
  • Run the bot: docker-compose up

In other words:

$ git clone https://github.com/PluralKit/PluralKit
$ cd PluralKit
$ cp pluralkit.conf.example pluralkit.conf
$ nano pluralkit.conf  # (or vim, or whatever)
$ docker-compose up -d

Manually

  • Install the .NET 6 SDK (see https://dotnet.microsoft.com/download)
  • Clone this repository: git clone https://github.com/PluralKit/PluralKit
  • Create and fill in a pluralkit.conf file in the same directory as docker-compose.yml
  • Run the bot: dotnet run --project PluralKit.Bot
    • Alternatively, dotnet build -c Release -o build/, then dotnet build/PluralKit.Bot.dll

(tip: use scripts/run-test-db.sh to run a temporary PostgreSQL database on your local system. Requires Docker.)

Scheduled Tasks worker

There is a scheduled tasks worker that needs to be ran separately from the bot. This handles cleaning up the database, and updating statistics (system/member/etc counts, shown in the pk;stats embed).

Note: This worker is not required, and the bot will function correctly without it.

If you are running the bot via docker-compose, this is set up automatically.

If you run the bot manually you can run the worker as such:

  • dotnet run --project PluralKit.ScheduledTasks
  • or if you used dotnet build rather than dotnet run to run the bot: dotnet build/PluralKit.ScheduledTasks.dll

Upgrading database from legacy version

If you have an instance of the Python version of the bot (from the legacy branch), you may need to take extra database migration steps. For more information, see LEGACYMIGRATE.md.

Documentation

See the docs/ directory

License

This project is under the GNU Affero General Public License, Version 3. It is available at the following link: https://www.gnu.org/licenses/agpl-3.0.en.html