Skip to content

Commit

Permalink
Update the README.md description
Browse files Browse the repository at this point in the history
Merge from maunium#46 and maunium#49
added more stickers
  • Loading branch information
ImSanae committed Apr 14, 2023
1 parent 824c553 commit 7fb9bda
Show file tree
Hide file tree
Showing 93 changed files with 455 additions and 143 deletions.
98 changes: 57 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,57 @@
# Maunium sticker picker
A fast and simple Matrix sticker picker widget. Tested on Element Web, Android & iOS.

## Discussion
Matrix room: [`#stickerpicker:maunium.net`](https://matrix.to/#/#stickerpicker:maunium.net)

## Instructions
For setup and usage instructions, please visit the [wiki](https://github.com/maunium/stickerpicker/wiki):

* [Creating packs](https://github.com/maunium/stickerpicker/wiki/Creating-packs)
* [Enabling the widget](https://github.com/maunium/stickerpicker/wiki/Enabling-the-widget)
* [Hosting on GitHub pages](https://github.com/maunium/stickerpicker/wiki/Hosting-on-GitHub-pages)

If you prefer video tutorials, [Brodie Robertson](https://www.youtube.com/c/BrodieRobertson) has made a great video on setting up the picker and creating some packs: https://youtu.be/Yz3H6KJTEI0.

## Comparison with other sticker pickers

* Scalar is the default integration manager in Element, which can't be self-hosted and only supports predefined sticker packs.
* [Dimension](https://github.com/turt2live/matrix-dimension) is an alternate integration manager. It can be self-hosted, but it's more difficult than Maunium sticker picker.
* Maunium sticker picker is just a sticker picker rather than a full integration manager. It's much simpler than integration managers, but currently has to be set up manually per-user.

| Feature | Scalar | Dimension | Maunium sticker picker |
|---------------------------------|--------|-----------|------------------------|
| Free software || ✔️ | ✔️ |
| Custom sticker packs || ✔️ | ✔️ |
| Telegram import || ✔️ | ✔️ |
| Works on Element mobiles | ✔️ || ✔️ |
| Easy multi-user setup | ✔️ | ✔️ | ❌<sup>[#7][#7]</sup> |
| Frequently used stickers at top ||| ✔️ |

[#7]: https://github.com/maunium/stickerpicker/issues/7

## Preview
### Element Web
![Element Web](preview-element-web.png)

### Element Android
![Element Android](preview-element-android.png)

### Element iOS (dark theme)
![Element iOS](preview-element-ios.png)
# Sanae's collection of Matrix sticker packs

> [Preview address](https://matrix-stickers.pages.dev/)
## How to use this?

This picker only supports Element (Web, Electron, Android, iOS) clients as well as clients based on it.

Type `/devtools` in any chat window of your Element (web or desktop) and send it, a Developer Tools window will open, select Explore account data, find m.widgets in it and add the following to the "content":

```
{
"stickerpicker": {
"content": {
"type": "m.stickerpicker",
"url": "https://matrix-stickers.pages.dev/?theme=$theme",
"name": "Stickerpicker",
"creatorUserId": "@you:matrix.server.name",
"data": {}
},
"sender": "@you:matrix.server.name",
"state_key": "stickerpicker",
"type": "m.widget",
"id": "stickerpicker"
}
}
```

If m.widgets is not found, select Send custom account data event directly in the bottom right corner, select m.widgets for the event type and fill in:


```
{
"type": "m.widgets",
"content": {
"stickerpicker": {
"content": {
"type": "m.stickerpicker",
"url": "https://matrix-stickers.pages.dev/?theme=$theme",
"name": "Stickerpicker",
"data": {}
},
"sender": "@you:matrix.server.name",
"state_key": "stickerpicker",
"type": "m.widget",
"id": "stickerpicker"
}
}
}
```
The same account should only need to be set up once.

## I'd like to add other stickers!

You can fork this repository and follow the [Wiki](https://github.com/maunium/stickerpicker/wiki/Creating-packs) prompts to import new stickers.The repository welcomes new sticker requests, so please initiate Pull Requests (from A to Z) by sorting the links to the original sticker pack.

Note: The repository does not accept stickers that contain explicit pornographic content.
10 changes: 5 additions & 5 deletions build/lib/sticker/stickerimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def add_meta(document: Document, info: matrix.StickerInfo, pack: StickerSetFull)
if isinstance(attr, DocumentAttributeSticker):
info["body"] = attr.alt
info["id"] = f"tg-{document.id}"
info["net.maunium.telegram.sticker"] = {
info["info"]["net.maunium.telegram.sticker"] = {
"pack": {
"id": str(pack.set.id),
"short_name": pack.set.short_name,
Expand Down Expand Up @@ -73,7 +73,7 @@ async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir
try:
with util.open_utf8(pack_path) as pack_file:
existing_pack = json.load(pack_file)
already_uploaded = {int(sticker["net.maunium.telegram.sticker"]["id"]): sticker
already_uploaded = {int(sticker["info"]["net.maunium.telegram.sticker"]["id"]): sticker
for sticker in existing_pack["stickers"]}
print(f"Found {len(already_uploaded)} already reuploaded stickers")
except FileNotFoundError:
Expand All @@ -97,7 +97,7 @@ async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir
# If there was no sticker metadata, use the first emoji we find
if doc["body"] == "":
doc["body"] = sticker.emoticon
doc["net.maunium.telegram.sticker"]["emoticons"].append(sticker.emoticon)
doc["info"]["net.maunium.telegram.sticker"]["emoticons"].append(sticker.emoticon)

with util.open_utf8(pack_path, "w") as pack_file:
json.dump({
Expand Down Expand Up @@ -132,7 +132,7 @@ async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir

async def main(args: argparse.Namespace) -> None:
await matrix.load_config(args.config)
client = TelegramClient(args.session, 298751, "cb676d6bae20553c9996996a8f52b4d7", proxy=("http", "localhost", 7890))
client = TelegramClient(args.session, 298751, "cb676d6bae20553c9996996a8f52b4d7")
await client.start()

if args.list:
Expand All @@ -153,7 +153,7 @@ async def main(args: argparse.Namespace) -> None:
return
input_packs.append(InputStickerSetShortName(short_name=match.group(1)))
for input_pack in input_packs:
pack: StickerSetFull = await client(GetStickerSetRequest(input_pack))
pack: StickerSetFull = await client(GetStickerSetRequest(input_pack, hash=0))
await reupload_pack(client, pack, args.output_dir)
else:
parser.print_help()
Expand Down
12 changes: 6 additions & 6 deletions build/lib/sticker/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated in setup.py

git_tag = None
git_revision = '86769c52'
version = '0.1.0+dev.86769c52'
linkified_version = '0.1.0+dev.[86769c52](https://github.com/maunium/stickerpicker/commit/86769c5291eef891de09070dbc61eb9248fb2aed)'
# Generated in setup.py

git_tag = None
git_revision = '3cb8276c'
version = '0.1.0+dev.3cb8276c'
linkified_version = '0.1.0+dev.[3cb8276c](https://github.com/maunium/stickerpicker/commit/3cb8276c44c08f7ecbde5138011de6b06141e198)'
Binary file removed preview-element-android.png
Binary file not shown.
Binary file removed preview-element-ios.png
Binary file not shown.
Binary file removed preview-element-web.png
Binary file not shown.
6 changes: 3 additions & 3 deletions sticker/stickerimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def add_meta(document: Document, info: matrix.StickerInfo, pack: StickerSetFull)
if isinstance(attr, DocumentAttributeSticker):
info["body"] = attr.alt
info["id"] = f"tg-{document.id}"
info["net.maunium.telegram.sticker"] = {
info["info"]["net.maunium.telegram.sticker"] = {
"pack": {
"id": str(pack.set.id),
"short_name": pack.set.short_name,
Expand Down Expand Up @@ -73,7 +73,7 @@ async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir
try:
with util.open_utf8(pack_path) as pack_file:
existing_pack = json.load(pack_file)
already_uploaded = {int(sticker["net.maunium.telegram.sticker"]["id"]): sticker
already_uploaded = {int(sticker["info"]["net.maunium.telegram.sticker"]["id"]): sticker
for sticker in existing_pack["stickers"]}
print(f"Found {len(already_uploaded)} already reuploaded stickers")
except FileNotFoundError:
Expand All @@ -97,7 +97,7 @@ async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir
# If there was no sticker metadata, use the first emoji we find
if doc["body"] == "":
doc["body"] = sticker.emoticon
doc["net.maunium.telegram.sticker"]["emoticons"].append(sticker.emoticon)
doc["info"]["net.maunium.telegram.sticker"]["emoticons"].append(sticker.emoticon)

with util.open_utf8(pack_path, "w") as pack_file:
json.dump({
Expand Down
12 changes: 6 additions & 6 deletions sticker/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated in setup.py

git_tag = None
git_revision = '86769c52'
version = '0.1.0+dev.86769c52'
linkified_version = '0.1.0+dev.[86769c52](https://github.com/maunium/stickerpicker/commit/86769c5291eef891de09070dbc61eb9248fb2aed)'
# Generated in setup.py

git_tag = None
git_revision = '3cb8276c'
version = '0.1.0+dev.3cb8276c'
linkified_version = '0.1.0+dev.[3cb8276c](https://github.com/maunium/stickerpicker/commit/3cb8276c44c08f7ecbde5138011de6b06141e198)'
1 change: 1 addition & 0 deletions web/packs/Akemi_Homura.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/packs/AmashiroNatsukiEars_NoWord.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/packs/AmashiroNatsukiNacho.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/packs/AmashiroNatsukiNya.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"title": "1 Year Sticker Nya [2020]", "id": "tg-622975720565506055", "net.maunium.telegram.pack": {"short_name": "AmashiroNatsukiNya", "hash": "904211459"}, "stickers": [{"body": "🍊", "url": "mxc://mozilla.org/4f502184a4c49db7d78539803fb51d703658b82e", "info": {"w": 211, "h": 256, "size": 176884, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/4f502184a4c49db7d78539803fb51d703658b82e", "thumbnail_info": {"w": 211, "h": 256, "size": 176884, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506341", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506341", "emoticons": ["🍊"]}}, {"body": "💝", "url": "mxc://mozilla.org/98e2ddae234f39a613387348c9bb137d4675f869", "info": {"w": 206, "h": 256, "size": 186750, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/98e2ddae234f39a613387348c9bb137d4675f869", "thumbnail_info": {"w": 206, "h": 256, "size": 186750, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506342", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506342", "emoticons": ["💝"]}}, {"body": "🍓", "url": "mxc://mozilla.org/8ab59cb069b128ae0629b96b7845f927db7a4fa7", "info": {"w": 201, "h": 256, "size": 180023, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/8ab59cb069b128ae0629b96b7845f927db7a4fa7", "thumbnail_info": {"w": 201, "h": 256, "size": 180023, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506343", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506343", "emoticons": ["🍓"]}}, {"body": "😲", "url": "mxc://mozilla.org/b3064b5f8ed9b0e1d63d4aaefcf61c3f23adf8ba", "info": {"w": 214, "h": 256, "size": 185607, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/b3064b5f8ed9b0e1d63d4aaefcf61c3f23adf8ba", "thumbnail_info": {"w": 214, "h": 256, "size": 185607, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506344", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506344", "emoticons": ["😲"]}}, {"body": "🐰", "url": "mxc://mozilla.org/3e40fb06728735e50be820af52880632645be34e", "info": {"w": 230, "h": 256, "size": 196421, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/3e40fb06728735e50be820af52880632645be34e", "thumbnail_info": {"w": 230, "h": 256, "size": 196421, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506345", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506345", "emoticons": ["🐰"]}}, {"body": "🍃", "url": "mxc://mozilla.org/be0f657ea8310bcaac71b87ec9b92fdaf44b9a3f", "info": {"w": 177, "h": 256, "size": 144772, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/be0f657ea8310bcaac71b87ec9b92fdaf44b9a3f", "thumbnail_info": {"w": 177, "h": 256, "size": 144772, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506346", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506346", "emoticons": ["🍃"]}}, {"body": "🏷", "url": "mxc://mozilla.org/ff835dcec6c4e3fbd5c9e5d27793c69501382c77", "info": {"w": 220, "h": 256, "size": 205218, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/ff835dcec6c4e3fbd5c9e5d27793c69501382c77", "thumbnail_info": {"w": 220, "h": 256, "size": 205218, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506347", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506347", "emoticons": ["🏷"]}}, {"body": "🍉", "url": "mxc://mozilla.org/80471c0d02ee6445aa411737ae1845d0f4ba0398", "info": {"w": 193, "h": 256, "size": 158506, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/80471c0d02ee6445aa411737ae1845d0f4ba0398", "thumbnail_info": {"w": 193, "h": 256, "size": 158506, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506348", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506348", "emoticons": ["🍉"]}}, {"body": "🥮", "url": "mxc://mozilla.org/4cb1d2bd38c2b15542a730b7e38a27adbe8c8076", "info": {"w": 198, "h": 256, "size": 181780, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/4cb1d2bd38c2b15542a730b7e38a27adbe8c8076", "thumbnail_info": {"w": 198, "h": 256, "size": 181780, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506349", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506349", "emoticons": ["🥮"]}}, {"body": "😈", "url": "mxc://mozilla.org/d44812cdcea8ac70da7c275d093bc3e2b44cc530", "info": {"w": 179, "h": 256, "size": 150196, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/d44812cdcea8ac70da7c275d093bc3e2b44cc530", "thumbnail_info": {"w": 179, "h": 256, "size": 150196, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506350", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506350", "emoticons": ["😈"]}}, {"body": "🥤", "url": "mxc://mozilla.org/1182b1f64177af6ce0e31416ae42903b9e77c146", "info": {"w": 176, "h": 256, "size": 202423, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/1182b1f64177af6ce0e31416ae42903b9e77c146", "thumbnail_info": {"w": 176, "h": 256, "size": 202423, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506351", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506351", "emoticons": ["🥤"]}}, {"body": "🦌", "url": "mxc://mozilla.org/1bc44b00120248ee6eefd90f3eba5f28ea34f67c", "info": {"w": 182, "h": 256, "size": 176330, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/1bc44b00120248ee6eefd90f3eba5f28ea34f67c", "thumbnail_info": {"w": 182, "h": 256, "size": 176330, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506352", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506352", "emoticons": ["🦌"]}}, {"body": "😼", "url": "mxc://mozilla.org/505b7dc1680ccb9b23bd39846313c94592eaae82", "info": {"w": 256, "h": 232, "size": 90597, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/505b7dc1680ccb9b23bd39846313c94592eaae82", "thumbnail_info": {"w": 256, "h": 232, "size": 90597, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506353", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506353", "emoticons": ["😼"]}}, {"body": "🙀", "url": "mxc://mozilla.org/8e75fe65f9d42323b917d5053ab741c4c2fb7ae9", "info": {"w": 254, "h": 256, "size": 62739, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/8e75fe65f9d42323b917d5053ab741c4c2fb7ae9", "thumbnail_info": {"w": 254, "h": 256, "size": 62739, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506354", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506354", "emoticons": ["🙀"]}}, {"body": "😾", "url": "mxc://mozilla.org/83f8b07125752e4c8b3fb3b048a3bf6cf74ffb75", "info": {"w": 254, "h": 256, "size": 87501, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/83f8b07125752e4c8b3fb3b048a3bf6cf74ffb75", "thumbnail_info": {"w": 254, "h": 256, "size": 87501, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506355", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506355", "emoticons": ["😾"]}}, {"body": "😺", "url": "mxc://mozilla.org/ce50c376ea6104d7b60dbe140fd6afb8a6d1da24", "info": {"w": 256, "h": 249, "size": 84998, "mimetype": "image/png", "thumbnail_url": "mxc://mozilla.org/ce50c376ea6104d7b60dbe140fd6afb8a6d1da24", "thumbnail_info": {"w": 256, "h": 249, "size": 84998, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "tg-622975720565506361", "net.maunium.telegram.sticker": {"pack": {"id": "622975720565506055", "short_name": "AmashiroNatsukiNya"}, "id": "622975720565506361", "emoticons": ["😺"]}}]}
1 change: 1 addition & 0 deletions web/packs/Baishengnv.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/packs/BelaiZaika.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/packs/BlueArchiveOfficialMangaMarkII.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/packs/Debian_MTF.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/packs/Ithinkthis.json

Large diffs are not rendered by default.

Loading

0 comments on commit 7fb9bda

Please sign in to comment.