Skip to content

Commit

Permalink
Merge from maunium#46 and added more stickers
Browse files Browse the repository at this point in the history
  • Loading branch information
ImSanae committed Apr 13, 2023
1 parent 824c553 commit bf0018d
Show file tree
Hide file tree
Showing 65 changed files with 350 additions and 102 deletions.
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)'
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)'
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/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 bf0018d

Please sign in to comment.