pluralsync/README.org

82 lines
4.1 KiB
Org Mode
Raw Permalink Normal View History

2023-11-23 17:20:33 +00:00
#+title: PluralSync
#+author: Jvnko @ lavenderfield
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:
#+begin_src js
{
"pk_key": "// Pluralkit token",
2023-11-26 09:20:09 +00:00
"sp_key": "// Simplplural token",
2024-01-14 00:57:56 +00:00
"avatar_module": {
2023-11-26 09:20:09 +00:00
"enabled": false,
2024-01-14 00:57:56 +00:00
"avatar_folder": "// Folder to grab profile pictures, they follow they member1member2...memberX.png format",
"avatar_output_path": "// Path for the copied selected avatar",
"blacklist": "// Array of members to not include in the avatar module"
2023-11-26 09:20:09 +00:00
},
"disc_module": {
"enabled": false,
"token": "// Discord user token",
2023-11-27 07:16:47 +00:00
"python_path": "// Path to the python executable",
2024-01-14 00:57:56 +00:00
"script_path": "// Path to updatediscordavatar.py"
},
"fedi_module": {
"enabled": false,
"instance" : "// Fedi instance url",
"token": "// Fedi bearer token"
2023-11-26 09:20:09 +00:00
}
2023-11-23 17:20:33 +00:00
}
#+end_src
Just fill it with PluralKit and SimplyPlural tokens associated to your account.
** Commands
2024-04-04 19:57:29 +00:00
- *Update* - Once the configuration is ready, you can start by calling the =update= 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.
2023-11-23 17:20:33 +00:00
2024-04-04 19:57:29 +00:00
*Remember to update whenever you change the information of the system! i.e. adding a new member, rename...*
2023-11-23 17:20:33 +00:00
2023-11-30 16:49:06 +00:00
- *Set* - Takes multiple arguments. Sets the current front to the selected list of members.
2023-11-23 17:20:33 +00:00
2023-11-30 16:49:06 +00:00
- *Add* - Takes multiple arguments. Adds the selected members to an already existing front.
2023-11-23 17:20:33 +00:00
2023-11-30 16:49:06 +00:00
- *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...).
2023-11-23 17:20:33 +00:00
2023-11-30 16:49:06 +00:00
- *Memberlist* - Writes the known list of members based on the =system.json= file.
2023-11-23 17:20:33 +00:00
2023-11-26 09:20:09 +00:00
** Modules
2024-01-14 00:57:56 +00:00
*** Avatar module
2023-11-26 10:20:52 +00:00
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=.
2024-01-14 00:57:56 +00:00
Notice this will cover all combinations, if the main front is Alice the combination =alicebob.png= instead. I personally use a python script to generate my set.
2023-11-26 10:20:52 +00:00
2023-11-26 09:20:09 +00:00
*** Discord module
2023-11-26 10:20:52 +00:00
**Use of this module goes against discord terms of service. USE AT YOUR OWN RISK.**
2024-01-14 00:57:56 +00:00
Requires the =avatar module= to be enabled and the latest version of [[https://github.com/dolfies/discord.py-self/][discord.py-self]].
Will change your discord avatar with the one selected by the avatar module.
*** Fedi module
Should be compatible with Mastodon, Pleroma and Akkoma.
Requires the =avatar module= to be enabled. Will set the avatar of your fediverse account to the one selected by the avatar module.
2023-11-26 09:20:09 +00:00
2023-11-27 07:16:47 +00:00
* Installation
2024-01-16 13:02:24 +00:00
Just build with cargo and move or symlink the executable wherever is more comofortable for you. Optionally, you can add the =avatar=, =discord= and =fedi= features
2023-11-27 07:16:47 +00:00
#+begin_src shell
2024-01-16 13:02:24 +00:00
cargo build -r --features discord,fedi
2023-11-27 07:16:47 +00:00
#+end_src
2023-11-23 17:20:33 +00:00
* 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.
2023-11-26 09:20:09 +00:00
- [X] Proper error handling (What I have currently is simply a mess)
2024-01-16 13:02:24 +00:00
- [X] Allow the user to set which front is used in cased of mismatch between PK and SP
- [X] Implement clap for command inputs
- [X] Actually separate the modules as actual modules