Tool written in rust to syncronize API calls between pluralkit and simplyplural
Go to file
Junko 219805384b installation 2023-11-27 08:16:47 +01:00
src capture discord module output 2023-11-26 10:58:47 +01:00
.gitignore get members 2023-11-21 15:38:25 +01:00
Cargo.lock readme 2023-11-23 18:20:33 +01:00
Cargo.toml readme 2023-11-23 18:20:33 +01:00
LICENSE license, optimization and stdout instructions 2023-11-23 17:40:34 +01:00
README.org installation 2023-11-27 08:16:47 +01:00
config.example.json pfp and disc modules 2023-11-26 10:20:09 +01:00
updatepfp.py capture discord module output 2023-11-26 10:58:47 +01:00

README.org

PluralSync

PluralSync is a small CLI application written in rust to syncronize and centralize the control over the front on SimplyPlural and PluralKit. It's my first project in rust, so the code is probably a mess and I'm most likely not making use of some rust features that would benefit the project.

Suggestions on how to improve the code are very welcome. After all, the objective with this project was learning more about the language.

Usage

Configuration

On the first run, if it does not exist, PluralSync will create a configuration directory and populate with a json file with the following structure:

{
  "pk_key": "// Pluralkit token",
  "sp_key": "// Simplplural token",
  "pfp_module": {
    "enabled": false,
    "pfp_folder": "// Folder to grab profile pictures, they follow they member1member2...memberX.png format",
    "pfp_output_path": "// Path for the copied selected pfp"
  },
  "disc_module": {
    "enabled": false,
    "token": "// Discord user token",
    "python_path": "// Path to the python executable",
    "script_path": "// Path to updatepfp.py"
  }
}

Just fill it with PluralKit and SimplyPlural tokens associated to your account.

Commands

Sync

Once the configuration is ready, you can start by calling the sync command, which will get the list of members of the system and place their data in a system.json file inside the configuration folder. Running commands like set or add without a present system.json will automatically fetch the data for you.

Remember to sync whenever you change the information of the system! i.e. adding a new member, rename…

Set

Takes multiple arguments. Sets the current front to the selected list of members.

Add

Takes multiple arguments. Adds the selected members to an already existing front.

Get

Displays the current front. The result is displayed in console but also stored in a plain text file named .front in the configuration directory, for use with other applications (Polybar, OBS…).

Memberlist

Writes the known list of members based on the system.json file.

Modules

PFP module

Will get a profile picture from a folder based on the currently fronting members and will copy it to the desired location. I recommend something it's easy to have at hand like ~/face.

The pictures in the path should be named according to the front. For example, if Bob and Alice are fronting, the module will copy {PATH}/bobalice.png to the location, or if it's only Bob it'll be bob.png. Notice this will cover all combinations, if the main front is Alice the combination alicebob.png instead. I recommend the use of a python script to generate the possible combinations.

Discord module

Use of this module goes against discord terms of service. USE AT YOUR OWN RISK.

Requires the PFP module to be enabled and the latest version of discord.py-self. Will change your discord avatar with the one selected by the PFP module.

Installation

Just build with cargo and move or symlink the executable wherever is more comofortable for you.

cargo build -r

Future

Given the nature of the project as a learning exercise, there are currently a set of features and improvements I'd like to add eventually.

  • Proper error handling (What I have currently is simply a mess)
  • Rofi and zenity support
  • Proper way to handle front conflicts between PluralKit and SimplyPlural