From 85813b22e5bded743f09ba9948fea18ff3c45654 Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:50:40 +0100 Subject: [PATCH 1/2] add missing msgtype = m.sticker On iOS the message is sent twice, with a duplicate event_id. It cause error on logs, in different places (synapse, mautrix, ...) It required to fix the already existing json or reimport the stickers. The "packs/scalar*" example already include this field, and it works. --- sticker/lib/matrix.py | 1 + sticker/lib/util.py | 1 + 2 files changed, 2 insertions(+) diff --git a/sticker/lib/matrix.py b/sticker/lib/matrix.py index 6d075bf..02fa925 100644 --- a/sticker/lib/matrix.py +++ b/sticker/lib/matrix.py @@ -42,6 +42,7 @@ if TYPE_CHECKING: url: str info: MediaInfo id: str + msgtype: str else: MediaInfo = None StickerInfo = None diff --git a/sticker/lib/util.py b/sticker/lib/util.py index 240e8ea..20c8763 100644 --- a/sticker/lib/util.py +++ b/sticker/lib/util.py @@ -74,4 +74,5 @@ def make_sticker(mxc: str, width: int, height: int, size: int, "mimetype": "image/png", }, }, + "msgtype": "m.sticker", } From 9443e79e97f45d0ed6c974fc23ec2ee510a4737b Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Sun, 7 Feb 2021 17:52:55 +0100 Subject: [PATCH 2/2] fix display of packs with sticker-import --list --- sticker/stickerimport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sticker/stickerimport.py b/sticker/stickerimport.py index 6846184..a2d7fd8 100644 --- a/sticker/stickerimport.py +++ b/sticker/stickerimport.py @@ -138,11 +138,12 @@ async def main(args: argparse.Namespace) -> None: if args.list: stickers: AllStickers = await client(GetAllStickersRequest(hash=0)) index = 1 - width = len(str(stickers.sets)) + width = len(str(len(stickers.sets))) print("Your saved sticker packs:") for saved_pack in stickers.sets: print(f"{index:>{width}}. {saved_pack.title} " f"(t.me/addstickers/{saved_pack.short_name})") + index += 1 elif args.pack[0]: input_packs = [] for pack_url in args.pack[0]: