2018-08-05 14:36:16 +00:00
RPCS3 Compatibility Bot
=======================
2018-02-16 15:58:05 +00:00
2022-11-09 04:23:32 +00:00
[![Build Status ](https://github.com/RPCS3/discord-bot/actions/workflows/dotnet.yml/badge.svg )](https://github.com/RPCS3/discord-bot/actions/workflows/dotnet.yml) [![RPCS3 discord server ](https://discordapp.com/api/guilds/272035812277878785/widget.png )](https://discord.me/rpcs3)
2019-08-23 12:59:04 +00:00
2019-08-26 11:57:32 +00:00
This is a tech support / moderation / crowd entertainment bot for the [RPCS3 discord server ](https://discord.me/rpcs3 ).
2019-02-13 16:40:59 +00:00
2019-03-29 14:51:44 +00:00
You can read the design and implementation notes by visiting the folders in the web interface, or from the [architecture overview notes ](architecture.md ).
2018-07-19 12:42:48 +00:00
Development Requirements
------------------------
2024-11-13 08:10:30 +00:00
* [.NET 9.0 SDK ](https://dotnet.microsoft.com/download ) or newer
2019-02-13 16:40:59 +00:00
* Any text editor, but here are some recommends:
2024-11-13 08:10:30 +00:00
* [Visual Studio ](https://visualstudio.microsoft.com/ ) (Windows, has free Community edition)
2019-02-13 16:40:59 +00:00
* [Visual Studio Code ](https://code.visualstudio.com/ ) (cross-platform, free)
2024-11-13 08:10:30 +00:00
* [JetBrains Rider ](https://www.jetbrains.com/rider/ ) (cross-platform, free for Non-Commercial use)
2018-02-16 15:58:05 +00:00
2018-07-19 12:42:48 +00:00
Runtime Requirements
--------------------
2024-11-13 08:10:30 +00:00
* [.NET 9.0 SDK ](https://dotnet.microsoft.com/download ) or newer to run from sources
2020-11-13 10:20:03 +00:00
* bot needs `dotnet` command to be available (i.e. alias for the Snap package)
2019-03-01 00:47:06 +00:00
* Optionally Google API credentials to access Google Drive:
* Create new project in the [Google Cloud Resource Manager ](https://console.developers.google.com/cloud-resource-manager )
2019-03-01 09:06:55 +00:00
* Select the project and enable [Google Drive API ](https://console.developers.google.com/apis/library/drive.googleapis.com )
2019-03-29 14:51:44 +00:00
* Open [API & Services Credentials ](https://console.developers.google.com/apis/credentials )
2019-03-01 00:47:06 +00:00
* Create new credentials:
* **Service account** credentials
* New service account
2019-03-01 17:52:52 +00:00
* if you select an existing account, **new** credentials will be generated **in addition** to previous any ones
* Role **Project > Viewer**
2019-03-01 00:47:06 +00:00
* Key type **JSON**
2019-03-01 09:06:55 +00:00
* **Create** will generate a configuration file
2020-11-13 10:20:03 +00:00
* Save said configuration file as `credentials.json` in [user secrets ](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-5.0#how-the-secret-manager-tool-works ) folder
2019-03-01 17:34:39 +00:00
* e.g on Linux this will be `~/.microsoft/usersecrets/c2e6548b-b215-4a18-a010-958ef294b310/credentials.json`
2018-02-16 15:58:05 +00:00
2018-07-19 12:42:48 +00:00
How to Build
------------
* Change configuration for test server in `CompatBot/Properties/launchSettings.json`
* Note that token could be set in the settings _or_ supplied as a launch argument (higher priority)
* If you've changed the database model, add a migration
2019-10-31 14:21:04 +00:00
* `$ dotnet tool install --global dotnet-ef` (if you have never installed the tools before)
2018-07-19 12:42:48 +00:00
* `$ cd CompatBot`
2018-08-03 16:39:57 +00:00
* `$ dotnet ef migrations add -c [BotDb|ThumbnailDb] MigrationName`
2018-07-19 12:42:48 +00:00
* `$ cd ..`
* `$ cd CompatBot`
* `$ dotnet run [token]`
2018-02-16 15:58:05 +00:00
2018-07-19 12:42:48 +00:00
How to Run in Production
------------------------
2019-08-24 15:46:10 +00:00
### Running from source
2019-03-01 17:52:52 +00:00
* Change configuration if needed (probably just token):
2019-03-01 10:56:54 +00:00
* use `$ dotnet user-secrets set Token <your_token_here>`
2019-03-01 17:52:52 +00:00
* for available configuration variables, see [Config.cs ](CompatBot/Config.cs#L31 )
* Put `bot.db` in `CompatBot/` if you have one
2018-07-19 12:42:48 +00:00
* `$ cd CompatBot`
2019-03-01 17:52:52 +00:00
* `$ dotnet run -c Release`
2019-02-02 15:03:51 +00:00
2019-08-24 15:46:10 +00:00
### Running with Docker
2019-09-30 15:17:43 +00:00
* Official image is hosted on [Docker Hub ](https://hub.docker.com/r/rpcs3/discord-bot ).
2019-08-24 15:46:10 +00:00
* You should pull images tagged with `release-latest` (same thing as `latest` )
2021-10-04 08:33:17 +00:00
* Please take a look at the [docker-compose.yml ](docker-compose.example.yml ) for required configuration (bot token and mounting points for persistent data).
2019-08-24 15:46:10 +00:00
2019-02-02 15:03:51 +00:00
External resources that need manual updates
-------------------------------------------
2021-02-16 15:11:11 +00:00
* [Unicode Confusables ](http://www.unicode.org/Public/security/latest/confusables.txt ), for Homoglyph checks
* [Windows Error Codes ](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/ ), for error decoding on non-Windows host
2021-03-09 11:46:31 +00:00
* Optionally pool of names (one name per line), files named as `names_<category>.txt`