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.

59 lines
2.4 KiB

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