You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.2 KiB

4 years ago
  1. # Maunium sticker picker
  2. A fast and simple Matrix sticker picker widget. Tested on Element Web & Android.
  3. ## Importing packs from Telegram
  4. 1. (Optional) Set up a virtual environment.
  5. 1. Create with `virtualenv -p python3 .`
  6. 2. Activate with `source ./bin/activate`
  7. 2. Install dependencies with `pip install -r requirements.txt`
  8. 3. Copy `example-config.json` to `config.json` and set your homeserver URL and access token
  9. (used for uploading stickers to Matrix).
  10. 4. Run `python3 import.py <pack urls...>`
  11. * On the first run, it'll prompt you to log in with a bot token or a telegram account.
  12. The session data is stored in `sticker-import.session` by default.
  13. * By default, the pack data will be written to `web/packs/`.
  14. * You can pass as many pack URLs as you want.
  15. * You can re-run the command with the same URLs to update packs.
  16. If you want to list the URLs of all your saved packs, use `python3 import.py --list`.
  17. This requires logging in with your account instead of a bot token.
  18. ## Enabling the sticker widget
  19. 1. Serve everything under `web/` using your webserver of choice. Make sure not to serve the
  20. top-level data, as `config.json` and the Telethon session file contain sensitive data.
  21. 2. Using `/devtools` in Element Web, edit the `m.widgets` account data event to have the following content:
  22. ```json
  23. {
  24. "stickerpicker": {
  25. "content": {
  26. "type": "m.stickerpicker",
  27. "url": "https://your.sticker.picker.url/index.html",
  28. "name": "Stickerpicker",
  29. "data": {}
  30. },
  31. "sender": "@you:picker.url",
  32. "state_key": "stickerpicker",
  33. "type": "m.widget",
  34. "id": "stickerpicker"
  35. }
  36. }
  37. ```
  38. If you do not yet have a `m.widgets` event, simply create it with that content.
  39. You can also [use the client-server API directly][1] instead of using Element Web.
  40. 3. Open the sticker picker and enjoy the fast sticker picking experience.
  41. [1]: https://matrix.org/docs/spec/client_server/latest#put-matrix-client-r0-user-userid-account-data-type
  42. ## Preview
  43. ### Element Web
  44. ![Element Web](preview-element-web.png)
  45. ### Element Android
  46. ![Element Android](preview-element-android.png)