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.

53 lines
2.1 KiB

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