Compare commits
No commits in common. "ddf7a05607d268ef26c9277051fe18122f1c28dd" and "804014f3b490192e90bf1dc9a60431d2310fc450" have entirely different histories.
ddf7a05607
...
804014f3b4
50 changed files with 11 additions and 691 deletions
|
@ -1,15 +0,0 @@
|
|||
name: Deploy to Server
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install/Update SSH
|
||||
run: apt install openssh-client
|
||||
- name: SSH into the Server
|
||||
run: ssh-rsa -p ${{ secrets.SSH_PUB }} stickers@192.168.1.107
|
||||
- name: Set the directory
|
||||
run: cd stickerpicker
|
||||
- name: Pull changes
|
||||
run: git pull
|
|
@ -1,23 +0,0 @@
|
|||
name: Update the stickers
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Update the stickers"]
|
||||
branches: [publish]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Set repository name to lowercase
|
||||
run: echo "REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||
|
||||
- name: Authenticate with registry
|
||||
run: docker login git.smgames.club -u ${{ github.repository_owner }} -p ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Build Docker container
|
||||
run: docker build --no-cache --progress=plain -t git.smgames.club/${{ env.REPO_NAME }}:latest .
|
||||
|
||||
- name: Push Docker container
|
||||
run: docker push git.smgames.club/${{ env.REPO_NAME }}:latest
|
|
@ -1,10 +0,0 @@
|
|||
name: Update the stickers
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
update:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
11
Dockerfile
11
Dockerfile
|
@ -1,11 +0,0 @@
|
|||
# Use the official NGINX image from the Docker Hub
|
||||
FROM nginx:latest
|
||||
|
||||
# Copy the local ./web directory into the container's NGINX html directory
|
||||
COPY ./web /usr/share/nginx/html
|
||||
|
||||
# Expose port 80 to be accessible externally
|
||||
EXPOSE 80
|
||||
|
||||
# NGINX will run automatically when the container starts
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -1,2 +0,0 @@
|
|||
__version__ = "0.1.0+dev"
|
||||
__author__ = "Tulir Asokan <tulir@maunium.net>"
|
|
@ -1,50 +0,0 @@
|
|||
import subprocess
|
||||
import shutil
|
||||
import os
|
||||
|
||||
from . import __version__
|
||||
|
||||
cmd_env = {
|
||||
"PATH": os.environ["PATH"],
|
||||
"HOME": os.environ["HOME"],
|
||||
"LANG": "C",
|
||||
"LC_ALL": "C",
|
||||
}
|
||||
|
||||
|
||||
def run(cmd):
|
||||
return subprocess.check_output(cmd, stderr=subprocess.DEVNULL, env=cmd_env)
|
||||
|
||||
|
||||
if (os.path.exists("../.git") or os.path.exists(".git")) and shutil.which("git"):
|
||||
try:
|
||||
git_revision = run(["git", "rev-parse", "HEAD"]).strip().decode("ascii")
|
||||
git_revision_url = f"https://github.com/maunium/stickerpicker/commit/{git_revision}"
|
||||
git_revision = git_revision[:8]
|
||||
except (subprocess.SubprocessError, OSError):
|
||||
git_revision = "unknown"
|
||||
git_revision_url = None
|
||||
|
||||
try:
|
||||
git_tag = run(["git", "describe", "--exact-match", "--tags"]).strip().decode("ascii")
|
||||
except (subprocess.SubprocessError, OSError):
|
||||
git_tag = None
|
||||
else:
|
||||
git_revision = "unknown"
|
||||
git_revision_url = None
|
||||
git_tag = None
|
||||
|
||||
git_tag_url = (f"https://github.com/maunium/stickerpicker/releases/tag/{git_tag}"
|
||||
if git_tag else None)
|
||||
|
||||
if git_tag and __version__ == git_tag[1:].replace("-", ""):
|
||||
version = __version__
|
||||
linkified_version = f"[{version}]({git_tag_url})"
|
||||
else:
|
||||
if not __version__.endswith("+dev"):
|
||||
__version__ += "+dev"
|
||||
version = f"{__version__}.{git_revision}"
|
||||
if git_revision_url:
|
||||
linkified_version = f"{__version__}.[{git_revision}]({git_revision_url})"
|
||||
else:
|
||||
linkified_version = version
|
|
@ -1,90 +0,0 @@
|
|||
# maunium-stickerpicker - A fast and simple Matrix sticker picker widget.
|
||||
# Copyright (C) 2020 Tulir Asokan
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
import json
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from yarl import URL
|
||||
|
||||
access_token: Optional[str] = None
|
||||
homeserver_url: Optional[str] = None
|
||||
|
||||
upload_url: Optional[URL] = None
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
class MediaInfo(TypedDict):
|
||||
w: int
|
||||
h: int
|
||||
size: int
|
||||
mimetype: str
|
||||
thumbnail_url: Optional[str]
|
||||
thumbnail_info: Optional['MediaInfo']
|
||||
|
||||
|
||||
class StickerInfo(TypedDict, total=False):
|
||||
body: str
|
||||
url: str
|
||||
info: MediaInfo
|
||||
id: str
|
||||
msgtype: str
|
||||
else:
|
||||
MediaInfo = None
|
||||
StickerInfo = None
|
||||
|
||||
|
||||
async def load_config(path: str) -> None:
|
||||
global access_token, homeserver_url, upload_url
|
||||
try:
|
||||
with open(path) as config_file:
|
||||
config = json.load(config_file)
|
||||
homeserver_url = config["homeserver"]
|
||||
access_token = config["access_token"]
|
||||
except FileNotFoundError:
|
||||
print("Matrix config file not found. Please enter your homeserver and access token.")
|
||||
homeserver_url = input("Homeserver URL: ")
|
||||
access_token = input("Access token: ")
|
||||
whoami_url = URL(homeserver_url) / "_matrix" / "client" / "r0" / "account" / "whoami"
|
||||
if whoami_url.scheme not in ("https", "http"):
|
||||
whoami_url = whoami_url.with_scheme("https")
|
||||
user_id = await whoami(whoami_url, access_token)
|
||||
with open(path, "w") as config_file:
|
||||
json.dump({
|
||||
"homeserver": homeserver_url,
|
||||
"user_id": user_id,
|
||||
"access_token": access_token,
|
||||
}, config_file)
|
||||
print(f"Wrote config to {path}")
|
||||
|
||||
upload_url = URL(homeserver_url) / "_matrix" / "media" / "r0" / "upload"
|
||||
|
||||
|
||||
async def whoami(url: URL, access_token: str) -> str:
|
||||
headers = {"Authorization": f"Bearer {access_token}"}
|
||||
async with ClientSession() as sess, sess.get(url, headers=headers) as resp:
|
||||
resp.raise_for_status()
|
||||
user_id = (await resp.json())["user_id"]
|
||||
print(f"Access token validated (user ID: {user_id})")
|
||||
return user_id
|
||||
|
||||
|
||||
async def upload(data: bytes, mimetype: str, filename: str) -> str:
|
||||
url = upload_url.with_query({"filename": filename})
|
||||
headers = {"Content-Type": mimetype, "Authorization": f"Bearer {access_token}"}
|
||||
async with ClientSession() as sess, sess.post(url, data=data, headers=headers) as resp:
|
||||
return (await resp.json())["content_uri"]
|
|
@ -1,80 +0,0 @@
|
|||
# maunium-stickerpicker - A fast and simple Matrix sticker picker widget.
|
||||
# Copyright (C) 2020 Tulir Asokan
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from functools import partial
|
||||
from io import BytesIO
|
||||
import os.path
|
||||
import json
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from . import matrix
|
||||
|
||||
open_utf8 = partial(open, encoding='UTF-8')
|
||||
|
||||
def convert_image(data: bytes) -> (bytes, int, int):
|
||||
image: Image.Image = Image.open(BytesIO(data)).convert("RGBA")
|
||||
new_file = BytesIO()
|
||||
image.save(new_file, "png")
|
||||
w, h = image.size
|
||||
if w > 256 or h > 256:
|
||||
# Set the width and height to lower values so clients wouldn't show them as huge images
|
||||
if w > h:
|
||||
h = int(h / (w / 256))
|
||||
w = 256
|
||||
else:
|
||||
w = int(w / (h / 256))
|
||||
h = 256
|
||||
return new_file.getvalue(), w, h
|
||||
|
||||
|
||||
def add_to_index(name: str, output_dir: str) -> None:
|
||||
index_path = os.path.join(output_dir, "index.json")
|
||||
try:
|
||||
with open_utf8(index_path) as index_file:
|
||||
index_data = json.load(index_file)
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
index_data = {"packs": []}
|
||||
if "homeserver_url" not in index_data and matrix.homeserver_url:
|
||||
index_data["homeserver_url"] = matrix.homeserver_url
|
||||
if name not in index_data["packs"]:
|
||||
index_data["packs"].append(name)
|
||||
with open_utf8(index_path, "w") as index_file:
|
||||
json.dump(index_data, index_file, indent=" ")
|
||||
print(f"Added {name} to {index_path}")
|
||||
|
||||
|
||||
def make_sticker(mxc: str, width: int, height: int, size: int,
|
||||
body: str = "") -> matrix.StickerInfo:
|
||||
return {
|
||||
"body": body,
|
||||
"url": mxc,
|
||||
"info": {
|
||||
"w": width,
|
||||
"h": height,
|
||||
"size": size,
|
||||
"mimetype": "image/png",
|
||||
|
||||
# Element iOS compatibility hack
|
||||
"thumbnail_url": mxc,
|
||||
"thumbnail_info": {
|
||||
"w": width,
|
||||
"h": height,
|
||||
"size": size,
|
||||
"mimetype": "image/png",
|
||||
},
|
||||
},
|
||||
"msgtype": "m.sticker",
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
# maunium-stickerpicker - A fast and simple Matrix sticker picker widget.
|
||||
# Copyright (C) 2020 Tulir Asokan
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from typing import Dict, Optional
|
||||
from hashlib import sha256
|
||||
import mimetypes
|
||||
import argparse
|
||||
import os.path
|
||||
import asyncio
|
||||
import string
|
||||
import json
|
||||
|
||||
try:
|
||||
import magic
|
||||
except ImportError:
|
||||
print("[Warning] Magic is not installed, using file extensions to guess mime types")
|
||||
magic = None
|
||||
|
||||
from .lib import matrix, util
|
||||
|
||||
|
||||
def convert_name(name: str) -> str:
|
||||
name_translate = {
|
||||
ord(" "): ord("_"),
|
||||
}
|
||||
allowed_chars = string.ascii_letters + string.digits + "_-/.#"
|
||||
return "".join(filter(lambda char: char in allowed_chars, name.translate(name_translate)))
|
||||
|
||||
|
||||
async def upload_sticker(file: str, directory: str, old_stickers: Dict[str, matrix.StickerInfo]
|
||||
) -> Optional[matrix.StickerInfo]:
|
||||
if file.startswith("."):
|
||||
return None
|
||||
path = os.path.join(directory, file)
|
||||
if not os.path.isfile(path):
|
||||
return None
|
||||
|
||||
if magic:
|
||||
mime = magic.from_file(path, mime=True)
|
||||
else:
|
||||
mime, _ = mimetypes.guess_type(file)
|
||||
if not mime.startswith("image/"):
|
||||
return None
|
||||
|
||||
print(f"Processing {file}", end="", flush=True)
|
||||
try:
|
||||
with open(path, "rb") as image_file:
|
||||
image_data = image_file.read()
|
||||
except Exception as e:
|
||||
print(f"... failed to read file: {e}")
|
||||
return None
|
||||
name = os.path.splitext(file)[0]
|
||||
|
||||
# If the name starts with "number-", remove the prefix
|
||||
name_split = name.split("-", 1)
|
||||
if len(name_split) == 2 and name_split[0].isdecimal():
|
||||
name = name_split[1]
|
||||
|
||||
sticker_id = f"sha256:{sha256(image_data).hexdigest()}"
|
||||
print(".", end="", flush=True)
|
||||
if sticker_id in old_stickers:
|
||||
sticker = {
|
||||
**old_stickers[sticker_id],
|
||||
"body": name,
|
||||
}
|
||||
print(f".. using existing upload")
|
||||
else:
|
||||
image_data, width, height = util.convert_image(image_data)
|
||||
print(".", end="", flush=True)
|
||||
mxc = await matrix.upload(image_data, "image/png", file)
|
||||
print(".", end="", flush=True)
|
||||
sticker = util.make_sticker(mxc, width, height, len(image_data), name)
|
||||
sticker["id"] = sticker_id
|
||||
print(" uploaded", flush=True)
|
||||
return sticker
|
||||
|
||||
|
||||
async def main(args: argparse.Namespace) -> None:
|
||||
await matrix.load_config(args.config)
|
||||
|
||||
dirname = os.path.basename(os.path.abspath(args.path))
|
||||
meta_path = os.path.join(args.path, "pack.json")
|
||||
try:
|
||||
with util.open_utf8(meta_path) as pack_file:
|
||||
pack = json.load(pack_file)
|
||||
print(f"Loaded existing pack meta from {meta_path}")
|
||||
except FileNotFoundError:
|
||||
pack = {
|
||||
"title": args.title or dirname,
|
||||
"id": args.id or convert_name(dirname),
|
||||
"stickers": [],
|
||||
}
|
||||
old_stickers = {}
|
||||
else:
|
||||
old_stickers = {sticker["id"]: sticker for sticker in pack["stickers"]}
|
||||
pack["stickers"] = []
|
||||
|
||||
for file in sorted(os.listdir(args.path)):
|
||||
sticker = await upload_sticker(file, args.path, old_stickers=old_stickers)
|
||||
if sticker:
|
||||
pack["stickers"].append(sticker)
|
||||
|
||||
with util.open_utf8(meta_path, "w") as pack_file:
|
||||
json.dump(pack, pack_file)
|
||||
print(f"Wrote pack to {meta_path}")
|
||||
|
||||
if args.add_to_index:
|
||||
picker_file_name = f"{pack['id']}.json"
|
||||
picker_pack_path = os.path.join(args.add_to_index, picker_file_name)
|
||||
with util.open_utf8(picker_pack_path, "w") as pack_file:
|
||||
json.dump(pack, pack_file)
|
||||
print(f"Copied pack to {picker_pack_path}")
|
||||
util.add_to_index(picker_file_name, args.add_to_index)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--config",
|
||||
help="Path to JSON file with Matrix homeserver and access_token",
|
||||
type=str, default="config.json", metavar="file")
|
||||
parser.add_argument("--title", help="Override the sticker pack displayname", type=str,
|
||||
metavar="title")
|
||||
parser.add_argument("--id", help="Override the sticker pack ID", type=str, metavar="id")
|
||||
parser.add_argument("--add-to-index", help="Sticker picker pack directory (usually 'web/packs/')",
|
||||
type=str, metavar="path")
|
||||
parser.add_argument("path", help="Path to the sticker pack directory", type=str)
|
||||
|
||||
|
||||
def cmd():
|
||||
asyncio.get_event_loop().run_until_complete(main(parser.parse_args()))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmd()
|
|
@ -1,56 +0,0 @@
|
|||
# maunium-stickerpicker - A fast and simple Matrix sticker picker widget.
|
||||
# Copyright (C) 2020 Tulir Asokan
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import sys
|
||||
import json
|
||||
|
||||
index_path = "../web/packs/index.json"
|
||||
|
||||
try:
|
||||
with util.open_utf8(index_path) as index_file:
|
||||
index_data = json.load(index_file)
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
index_data = {"packs": []}
|
||||
|
||||
with util.open_utf8(sys.argv[-1]) as file:
|
||||
data = json.load(file)
|
||||
|
||||
for pack in data["assets"]:
|
||||
title = pack["name"].title()
|
||||
if "images" not in pack["data"]:
|
||||
print(f"Skipping {title}")
|
||||
continue
|
||||
pack_id = f"scalar-{pack['asset_id']}"
|
||||
stickers = []
|
||||
for sticker in pack["data"]["images"]:
|
||||
sticker_data = sticker["content"]
|
||||
sticker_data["id"] = sticker_data["url"].split("/")[-1]
|
||||
stickers.append(sticker_data)
|
||||
pack_data = {
|
||||
"title": title,
|
||||
"id": pack_id,
|
||||
"stickers": stickers,
|
||||
}
|
||||
filename = f"scalar-{pack['name'].replace(' ', '_')}.json"
|
||||
pack_path = f"web/packs/{filename}"
|
||||
with util.open_utf8(pack_path, "w") as pack_file:
|
||||
json.dump(pack_data, pack_file)
|
||||
print(f"Wrote {title} to {pack_path}")
|
||||
if filename not in index_data["packs"]:
|
||||
index_data["packs"].append(filename)
|
||||
|
||||
with util.open_utf8(index_path, "w") as index_file:
|
||||
json.dump(index_data, index_file, indent=" ")
|
||||
print(f"Updated {index_path}")
|
|
@ -1,165 +0,0 @@
|
|||
# maunium-stickerpicker - A fast and simple Matrix sticker picker widget.
|
||||
# Copyright (C) 2020 Tulir Asokan
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from typing import Dict
|
||||
import argparse
|
||||
import asyncio
|
||||
import os.path
|
||||
import json
|
||||
import re
|
||||
|
||||
from telethon import TelegramClient
|
||||
from telethon.tl.functions.messages import GetAllStickersRequest, GetStickerSetRequest
|
||||
from telethon.tl.types.messages import AllStickers
|
||||
from telethon.tl.types import InputStickerSetShortName, Document, DocumentAttributeSticker
|
||||
from telethon.tl.types.messages import StickerSet as StickerSetFull
|
||||
|
||||
from .lib import matrix, util
|
||||
|
||||
|
||||
async def reupload_document(client: TelegramClient, document: Document) -> matrix.StickerInfo:
|
||||
print(f"Reuploading {document.id}", end="", flush=True)
|
||||
data = await client.download_media(document, file=bytes)
|
||||
print(".", end="", flush=True)
|
||||
data, width, height = util.convert_image(data)
|
||||
print(".", end="", flush=True)
|
||||
mxc = await matrix.upload(data, "image/png", f"{document.id}.png")
|
||||
print(".", flush=True)
|
||||
return util.make_sticker(mxc, width, height, len(data))
|
||||
|
||||
|
||||
def add_meta(document: Document, info: matrix.StickerInfo, pack: StickerSetFull) -> None:
|
||||
for attr in document.attributes:
|
||||
if isinstance(attr, DocumentAttributeSticker):
|
||||
info["body"] = attr.alt
|
||||
info["id"] = f"tg-{document.id}"
|
||||
info["net.maunium.telegram.sticker"] = {
|
||||
"pack": {
|
||||
"id": str(pack.set.id),
|
||||
"short_name": pack.set.short_name,
|
||||
},
|
||||
"id": str(document.id),
|
||||
"emoticons": [],
|
||||
}
|
||||
|
||||
|
||||
async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir: str) -> None:
|
||||
pack_path = os.path.join(output_dir, f"{pack.set.short_name}.json")
|
||||
try:
|
||||
os.mkdir(os.path.dirname(pack_path))
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
print(f"Reuploading {pack.set.title} with {pack.set.count} stickers "
|
||||
f"and writing output to {pack_path}")
|
||||
|
||||
already_uploaded = {}
|
||||
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
|
||||
for sticker in existing_pack["stickers"]}
|
||||
print(f"Found {len(already_uploaded)} already reuploaded stickers")
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
reuploaded_documents: Dict[int, matrix.StickerInfo] = {}
|
||||
for document in pack.documents:
|
||||
try:
|
||||
reuploaded_documents[document.id] = already_uploaded[document.id]
|
||||
print(f"Skipped reuploading {document.id}")
|
||||
except KeyError:
|
||||
reuploaded_documents[document.id] = await reupload_document(client, document)
|
||||
# Always ensure the body and telegram metadata is correct
|
||||
add_meta(document, reuploaded_documents[document.id], pack)
|
||||
|
||||
for sticker in pack.packs:
|
||||
if not sticker.emoticon:
|
||||
continue
|
||||
for document_id in sticker.documents:
|
||||
doc = reuploaded_documents[document_id]
|
||||
# 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)
|
||||
|
||||
with util.open_utf8(pack_path, "w") as pack_file:
|
||||
json.dump({
|
||||
"title": pack.set.title,
|
||||
"id": f"tg-{pack.set.id}",
|
||||
"net.maunium.telegram.pack": {
|
||||
"short_name": pack.set.short_name,
|
||||
"hash": str(pack.set.hash),
|
||||
},
|
||||
"stickers": list(reuploaded_documents.values()),
|
||||
}, pack_file, ensure_ascii=False)
|
||||
print(f"Saved {pack.set.title} as {pack.set.short_name}.json")
|
||||
|
||||
util.add_to_index(os.path.basename(pack_path), output_dir)
|
||||
|
||||
|
||||
pack_url_regex = re.compile(r"^(?:(?:https?://)?(?:t|telegram)\.(?:me|dog)/addstickers/)?"
|
||||
r"([A-Za-z0-9-_]+)"
|
||||
r"(?:\.json)?$")
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("--list", help="List your saved sticker packs", action="store_true")
|
||||
parser.add_argument("--session", help="Telethon session file name", default="sticker-import")
|
||||
parser.add_argument("--config",
|
||||
help="Path to JSON file with Matrix homeserver and access_token",
|
||||
type=str, default="config.json")
|
||||
parser.add_argument("--output-dir", help="Directory to write packs to", default="web/packs/",
|
||||
type=str)
|
||||
parser.add_argument("pack", help="Sticker pack URLs to import", action="append", nargs="*")
|
||||
|
||||
|
||||
async def main(args: argparse.Namespace) -> None:
|
||||
await matrix.load_config(args.config)
|
||||
client = TelegramClient(args.session, 298751, "cb676d6bae20553c9996996a8f52b4d7")
|
||||
await client.start()
|
||||
|
||||
if args.list:
|
||||
stickers: AllStickers = await client(GetAllStickersRequest(hash=0))
|
||||
index = 1
|
||||
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]:
|
||||
match = pack_url_regex.match(pack_url)
|
||||
if not match:
|
||||
print(f"'{pack_url}' doesn't look like a sticker pack URL")
|
||||
return
|
||||
input_packs.append(InputStickerSetShortName(short_name=match.group(1)))
|
||||
for input_pack in input_packs:
|
||||
pack: StickerSetFull = await client(GetStickerSetRequest(input_pack, hash=0))
|
||||
await reupload_pack(client, pack, args.output_dir)
|
||||
else:
|
||||
parser.print_help()
|
||||
|
||||
await client.disconnect()
|
||||
|
||||
|
||||
def cmd() -> None:
|
||||
asyncio.get_event_loop().run_until_complete(main(parser.parse_args()))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmd()
|
|
@ -1,6 +0,0 @@
|
|||
# Generated in setup.py
|
||||
|
||||
git_tag = None
|
||||
git_revision = '5c672b64'
|
||||
version = '0.1.0+dev.5c672b64'
|
||||
linkified_version = '0.1.0+dev.[5c672b64](https://github.com/maunium/stickerpicker/commit/5c672b64f956f96f58065a352f13952bf99d110c)'
|
|
@ -5,7 +5,7 @@ go 1.22.3
|
|||
require (
|
||||
go.mau.fi/util v0.5.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
maunium.net/go/mautrix v0.19.0-beta.1.0.20240619092812-451658374280
|
||||
maunium.net/go/mautrix v0.19.0-beta.1.0.20240619084603-3e302fb46fdb
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
|
@ -43,5 +43,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
|
|||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
maunium.net/go/mautrix v0.19.0-beta.1.0.20240619092812-451658374280 h1:+EHJF8h7obPow7kDnsmGoWN+bTCjHGxCKaH99MldZUI=
|
||||
maunium.net/go/mautrix v0.19.0-beta.1.0.20240619092812-451658374280/go.mod h1:cxv1w6+syudmEpOewHYIQT9yO7TM5UOWmf6xEBVI4H4=
|
||||
maunium.net/go/mautrix v0.19.0-beta.1.0.20240619084603-3e302fb46fdb h1:xOe8J6rG2ADTVl56+SFDBDJkwmfCzNpVHLDxHZS+c0w=
|
||||
maunium.net/go/mautrix v0.19.0-beta.1.0.20240619084603-3e302fb46fdb/go.mod h1:cxv1w6+syudmEpOewHYIQT9yO7TM5UOWmf6xEBVI4H4=
|
||||
|
|
|
@ -49,8 +49,6 @@ func main() {
|
|||
var cfg Config
|
||||
exerrors.PanicIfNotNil(yaml.Unmarshal(cfgFile, &cfg))
|
||||
mp := exerrors.Must(mediaproxy.NewFromConfig(cfg.BasicConfig, getMedia))
|
||||
mp.KeyServer.Version.Name = "maunium-stickerpicker giphy proxy"
|
||||
mp.ForceProxyLegacyFederation = true
|
||||
exerrors.PanicIfNotNil(mp.Listen(cfg.ServerConfig))
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 93 KiB |
Binary file not shown.
Before Width: | Height: | Size: 76 KiB |
|
@ -1 +0,0 @@
|
|||
{"title": "Rust", "id": "Rust", "stickers": [{"body": "does_not_compile", "url": "mxc://smgames.club/QtoQnFEqWwBXUfKfugJXnivn", "info": {"w": 256, "h": 172, "size": 74446, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/QtoQnFEqWwBXUfKfugJXnivn", "thumbnail_info": {"w": 256, "h": 172, "size": 74446, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:d2d95490568c3199fee080f957a907ae1b28690249254b4c139673b97453ddcb"}, {"body": "not_desired_behavior", "url": "mxc://smgames.club/WLCKEngadTiIJFlLnIEPpPiM", "info": {"w": 256, "h": 154, "size": 57546, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/WLCKEngadTiIJFlLnIEPpPiM", "thumbnail_info": {"w": 256, "h": 154, "size": 57546, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:a52f680c930ca42a07e8873b31a73238382c305ca32bbac691d9cd5cc7740a68"}, {"body": "panics", "url": "mxc://smgames.club/DQKIOaNDBvOzWzQDhYgDeEWg", "info": {"w": 256, "h": 168, "size": 67042, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/DQKIOaNDBvOzWzQDhYgDeEWg", "thumbnail_info": {"w": 256, "h": 168, "size": 67042, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:d976f96143afacd38d71fac442bb946b514a5c62c309906d2e0b7c58a32cd601"}]}
|
Binary file not shown.
Before Width: | Height: | Size: 90 KiB |
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
|
@ -1 +0,0 @@
|
|||
{"title": "emotes", "id": "emotes", "stickers": [{"body": "bad_pog", "url": "mxc://smgames.club/kbTavSkGDuNkPrXnqxIquhvV", "info": {"w": 112, "h": 112, "size": 19551, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/kbTavSkGDuNkPrXnqxIquhvV", "thumbnail_info": {"w": 112, "h": 112, "size": 19551, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:e2e9e79c0250b285fdf64a7c2cba066549431446013fdcba4e192457f4b3a76f"}, {"body": "mad_heart", "url": "mxc://smgames.club/tSKQdCSyauufWTUBvVenTXPU", "info": {"w": 112, "h": 112, "size": 21426, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/tSKQdCSyauufWTUBvVenTXPU", "thumbnail_info": {"w": 112, "h": 112, "size": 21426, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:de6d99e1efd5187c3b99a7a48dfb4e1604ce5dc56715dd955c9fe455d9ef0bb2"}]}
|
|
@ -56,6 +56,10 @@ def add_meta(document: Document, info: matrix.StickerInfo, pack: StickerSetFull)
|
|||
|
||||
|
||||
async def reupload_pack(client: TelegramClient, pack: StickerSetFull, output_dir: str) -> None:
|
||||
if pack.set.animated:
|
||||
print("Animated stickerpacks are currently not supported")
|
||||
return
|
||||
|
||||
pack_path = os.path.join(output_dir, f"{pack.set.short_name}.json")
|
||||
try:
|
||||
os.mkdir(os.path.dirname(pack_path))
|
||||
|
|
|
@ -1,6 +1 @@
|
|||
# Generated in setup.py
|
||||
|
||||
git_tag = None
|
||||
git_revision = '5c672b64'
|
||||
version = '0.1.0+dev.5c672b64'
|
||||
linkified_version = '0.1.0+dev.[5c672b64](https://github.com/maunium/stickerpicker/commit/5c672b64f956f96f58065a352f13952bf99d110c)'
|
||||
from .get_version import git_tag, git_revision, version, linkified_version
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
{"title": "Rust", "id": "Rust", "stickers": [{"body": "does_not_compile", "url": "mxc://smgames.club/QtoQnFEqWwBXUfKfugJXnivn", "info": {"w": 256, "h": 172, "size": 74446, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/QtoQnFEqWwBXUfKfugJXnivn", "thumbnail_info": {"w": 256, "h": 172, "size": 74446, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:d2d95490568c3199fee080f957a907ae1b28690249254b4c139673b97453ddcb"}, {"body": "not_desired_behavior", "url": "mxc://smgames.club/WLCKEngadTiIJFlLnIEPpPiM", "info": {"w": 256, "h": 154, "size": 57546, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/WLCKEngadTiIJFlLnIEPpPiM", "thumbnail_info": {"w": 256, "h": 154, "size": 57546, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:a52f680c930ca42a07e8873b31a73238382c305ca32bbac691d9cd5cc7740a68"}, {"body": "panics", "url": "mxc://smgames.club/DQKIOaNDBvOzWzQDhYgDeEWg", "info": {"w": 256, "h": 168, "size": 67042, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/DQKIOaNDBvOzWzQDhYgDeEWg", "thumbnail_info": {"w": 256, "h": 168, "size": 67042, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:d976f96143afacd38d71fac442bb946b514a5c62c309906d2e0b7c58a32cd601"}]}
|
|
@ -1 +0,0 @@
|
|||
{"title": "emotes", "id": "emotes", "stickers": [{"body": "bad_pog", "url": "mxc://smgames.club/kbTavSkGDuNkPrXnqxIquhvV", "info": {"w": 112, "h": 112, "size": 19551, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/kbTavSkGDuNkPrXnqxIquhvV", "thumbnail_info": {"w": 112, "h": 112, "size": 19551, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:e2e9e79c0250b285fdf64a7c2cba066549431446013fdcba4e192457f4b3a76f"}, {"body": "mad_heart", "url": "mxc://smgames.club/tSKQdCSyauufWTUBvVenTXPU", "info": {"w": 112, "h": 112, "size": 21426, "mimetype": "image/png", "thumbnail_url": "mxc://smgames.club/tSKQdCSyauufWTUBvVenTXPU", "thumbnail_info": {"w": 112, "h": 112, "size": 21426, "mimetype": "image/png"}}, "msgtype": "m.sticker", "id": "sha256:de6d99e1efd5187c3b99a7a48dfb4e1604ce5dc56715dd955c9fe455d9ef0bb2"}]}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"packs": [
|
||||
"emotes.json",
|
||||
"Rust.json",
|
||||
"scalar-geeko.json",
|
||||
"scalar-isabella.json",
|
||||
"scalar-loading_artist.json"
|
||||
],
|
||||
"homeserver_url": "https://smgames.club"
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"title": "Geeko", "id": "scalar-191580", "stickers": [{"body": "Geeko with a suitcase, wearing a suit", "info": {"h": 256, "mimetype": "image/png", "size": 41241, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 41241, "w": 256}, "thumbnail_url": "mxc://matrix.org/GWyQoBKgXAoIXhBcCMCxmkxd", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/GWyQoBKgXAoIXhBcCMCxmkxd", "id": "GWyQoBKgXAoIXhBcCMCxmkxd"}, {"body": "Geeko driving away in a car waving", "info": {"h": 256, "mimetype": "image/png", "size": 51387, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 51387, "w": 256}, "thumbnail_url": "mxc://matrix.org/JkAPbbuIuOMMbWqhKTNnGETu", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/JkAPbbuIuOMMbWqhKTNnGETu", "id": "JkAPbbuIuOMMbWqhKTNnGETu"}, {"body": "Geeko enjoying his time in an armchair with a cup of tea", "info": {"h": 256, "mimetype": "image/png", "size": 44188, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 44188, "w": 256}, "thumbnail_url": "mxc://matrix.org/AdkCycKHKGfgpyOCrlcSihDK", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/AdkCycKHKGfgpyOCrlcSihDK", "id": "AdkCycKHKGfgpyOCrlcSihDK"}, {"body": "Sick Geeko wrapped in a blanket with a tray of refreshing bevarage", "info": {"h": 256, "mimetype": "image/png", "size": 36364, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 36364, "w": 256}, "thumbnail_url": "mxc://matrix.org/SNkQWaqBkKwIEHQyJmAuhnIL", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/SNkQWaqBkKwIEHQyJmAuhnIL", "id": "SNkQWaqBkKwIEHQyJmAuhnIL"}, {"body": "Geeko in a balerina skirt inviting to dance with them", "info": {"h": 256, "mimetype": "image/png", "size": 34716, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 34716, "w": 256}, "thumbnail_url": "mxc://matrix.org/WLjGVDOlqAPtMaggqcgmjZsB", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/WLjGVDOlqAPtMaggqcgmjZsB", "id": "WLjGVDOlqAPtMaggqcgmjZsB"}, {"body": "Geeko laying on a cloud", "info": {"h": 256, "mimetype": "image/png", "size": 39189, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 39189, "w": 256}, "thumbnail_url": "mxc://matrix.org/ouaitVRUeqIJCuMuKLNtzOPl", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/ouaitVRUeqIJCuMuKLNtzOPl", "id": "ouaitVRUeqIJCuMuKLNtzOPl"}, {"body": "Geeko stretching", "info": {"h": 256, "mimetype": "image/png", "size": 34670, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 34670, "w": 256}, "thumbnail_url": "mxc://matrix.org/DXEyavdgypGEPLeWdmaAkOAG", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/DXEyavdgypGEPLeWdmaAkOAG", "id": "DXEyavdgypGEPLeWdmaAkOAG"}, {"body": "Geeko aproaching Nirvana", "info": {"h": 256, "mimetype": "image/png", "size": 42035, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 42035, "w": 256}, "thumbnail_url": "mxc://matrix.org/DRCkchiNQgASUCFTxFDDfhvi", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/DRCkchiNQgASUCFTxFDDfhvi", "id": "DRCkchiNQgASUCFTxFDDfhvi"}, {"body": "Geeko dressed in a paper airplane, running", "info": {"h": 256, "mimetype": "image/png", "size": 49568, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 49568, "w": 256}, "thumbnail_url": "mxc://matrix.org/YrJQDfZpESKIYdUzvhMDXBLU", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/YrJQDfZpESKIYdUzvhMDXBLU", "id": "YrJQDfZpESKIYdUzvhMDXBLU"}, {"body": "Geeko drawing an animal", "info": {"h": 256, "mimetype": "image/png", "size": 54112, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 54112, "w": 256}, "thumbnail_url": "mxc://matrix.org/bHmdDCDjmolEjrxAFDGuHoJa", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/bHmdDCDjmolEjrxAFDGuHoJa", "id": "bHmdDCDjmolEjrxAFDGuHoJa"}]}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
{"title": "Privacy Pam", "id": "scalar-191583", "stickers": [{"body": "Privacy Pam is Angry", "info": {"h": 256, "mimetype": "image/png", "size": 184861, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 184861, "w": 256}, "thumbnail_url": "mxc://matrix.org/WYZLGkpAXwgOftafRtSQVNYF", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/WYZLGkpAXwgOftafRtSQVNYF", "id": "WYZLGkpAXwgOftafRtSQVNYF"}, {"body": "Privacy Pam Cries", "info": {"h": 256, "mimetype": "image/png", "size": 164740, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 164740, "w": 256}, "thumbnail_url": "mxc://matrix.org/aVOIYKvTRBiKqZbxomKeuwYD", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/aVOIYKvTRBiKqZbxomKeuwYD", "id": "aVOIYKvTRBiKqZbxomKeuwYD"}, {"body": "Privacy Pam is Happy", "info": {"h": 256, "mimetype": "image/png", "size": 172907, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 172907, "w": 256}, "thumbnail_url": "mxc://matrix.org/FZolsrwTDUJoLlGfWHffwuFP", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/FZolsrwTDUJoLlGfWHffwuFP", "id": "FZolsrwTDUJoLlGfWHffwuFP"}, {"body": "Privacy Pam Laughs", "info": {"h": 256, "mimetype": "image/png", "size": 170855, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 170855, "w": 256}, "thumbnail_url": "mxc://matrix.org/qTfporLEnxtdkdwmPUQwWNtg", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/qTfporLEnxtdkdwmPUQwWNtg", "id": "qTfporLEnxtdkdwmPUQwWNtg"}, {"body": "Privacy Pam is Sad", "info": {"h": 256, "mimetype": "image/png", "size": 179575, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 179575, "w": 256}, "thumbnail_url": "mxc://matrix.org/MvUDjTTYKanEzFAExAhJfyAL", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/MvUDjTTYKanEzFAExAhJfyAL", "id": "MvUDjTTYKanEzFAExAhJfyAL"}, {"body": "Privacy Pam Smiles", "info": {"h": 256, "mimetype": "image/png", "size": 185764, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 185764, "w": 256}, "thumbnail_url": "mxc://matrix.org/cUbyqEDvdvxMqnfBGKmIpgfp", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/cUbyqEDvdvxMqnfBGKmIpgfp", "id": "cUbyqEDvdvxMqnfBGKmIpgfp"}, {"body": "Privacy Pam is Thinking", "info": {"h": 256, "mimetype": "image/png", "size": 199567, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 199567, "w": 256}, "thumbnail_url": "mxc://matrix.org/JnxtjVDYQHKGMWDRqSDgCwPL", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/JnxtjVDYQHKGMWDRqSDgCwPL", "id": "JnxtjVDYQHKGMWDRqSDgCwPL"}, {"body": "Privacy Pam Likes", "info": {"h": 256, "mimetype": "image/png", "size": 196924, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 196924, "w": 256}, "thumbnail_url": "mxc://matrix.org/umFLoIIzwirpWpcbnlgbtNNW", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/umFLoIIzwirpWpcbnlgbtNNW", "id": "umFLoIIzwirpWpcbnlgbtNNW"}, {"body": "Privacy Pam Winks", "info": {"h": 256, "mimetype": "image/png", "size": 167280, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 167280, "w": 256}, "thumbnail_url": "mxc://matrix.org/mehuoFXMMUdUSezwTwkkxHCB", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/mehuoFXMMUdUSezwTwkkxHCB", "id": "mehuoFXMMUdUSezwTwkkxHCB"}]}
|
|
@ -1 +0,0 @@
|
|||
{"title": "Rabbit", "id": "scalar-191566", "stickers": [{"body": "Carrot", "info": {"h": 200, "mimetype": "image/png", "size": 80625, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 80625, "w": 142}, "thumbnail_url": "mxc://matrix.org/kGJDCjMOgpLmZzbgknMTUHNm", "w": 142}, "msgtype": "m.sticker", "url": "mxc://matrix.org/kGJDCjMOgpLmZzbgknMTUHNm", "id": "kGJDCjMOgpLmZzbgknMTUHNm"}, {"body": "Chef", "info": {"h": 200, "mimetype": "image/png", "size": 88633, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 88633, "w": 151}, "thumbnail_url": "mxc://matrix.org/szaTExsJurtDBUUEeHHbhyqk", "w": 151}, "msgtype": "m.sticker", "url": "mxc://matrix.org/szaTExsJurtDBUUEeHHbhyqk", "id": "szaTExsJurtDBUUEeHHbhyqk"}, {"body": "Coding", "info": {"h": 185, "mimetype": "image/png", "size": 97412, "thumbnail_info": {"h": 185, "mimetype": "image/png", "size": 97412, "w": 200}, "thumbnail_url": "mxc://matrix.org/DykipVHRXsfamLGJscNLbFAB", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/DykipVHRXsfamLGJscNLbFAB", "id": "DykipVHRXsfamLGJscNLbFAB"}, {"body": "Doctor", "info": {"h": 200, "mimetype": "image/png", "size": 113391, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 113391, "w": 184}, "thumbnail_url": "mxc://matrix.org/GEhjrKIapqcbVWKEsoDMhXeZ", "w": 184}, "msgtype": "m.sticker", "url": "mxc://matrix.org/GEhjrKIapqcbVWKEsoDMhXeZ", "id": "GEhjrKIapqcbVWKEsoDMhXeZ"}, {"body": "Driving", "info": {"h": 200, "mimetype": "image/png", "size": 77577, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 77577, "w": 156}, "thumbnail_url": "mxc://matrix.org/jxPXTKpyydzdHJkdFNZjTZrD", "w": 156}, "msgtype": "m.sticker", "url": "mxc://matrix.org/jxPXTKpyydzdHJkdFNZjTZrD", "id": "jxPXTKpyydzdHJkdFNZjTZrD"}, {"body": "Landing", "info": {"h": 200, "mimetype": "image/png", "size": 73602, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 73602, "w": 140}, "thumbnail_url": "mxc://matrix.org/sHhqkFCvSkFwtmvtETOtKnLP", "w": 140}, "msgtype": "m.sticker", "url": "mxc://matrix.org/sHhqkFCvSkFwtmvtETOtKnLP", "id": "sHhqkFCvSkFwtmvtETOtKnLP"}, {"body": "Phone", "info": {"h": 200, "mimetype": "image/png", "size": 94007, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 94007, "w": 172}, "thumbnail_url": "mxc://matrix.org/mnNNbLjjLjQIcKaybAyVMKMQ", "w": 172}, "msgtype": "m.sticker", "url": "mxc://matrix.org/mnNNbLjjLjQIcKaybAyVMKMQ", "id": "mnNNbLjjLjQIcKaybAyVMKMQ"}, {"body": "Running", "info": {"h": 157, "mimetype": "image/png", "size": 83290, "thumbnail_info": {"h": 157, "mimetype": "image/png", "size": 83290, "w": 200}, "thumbnail_url": "mxc://matrix.org/gloPNMnAwUEtrtTsaeqPTlhK", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/gloPNMnAwUEtrtTsaeqPTlhK", "id": "gloPNMnAwUEtrtTsaeqPTlhK"}, {"body": "Science", "info": {"h": 200, "mimetype": "image/png", "size": 103111, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 103111, "w": 155}, "thumbnail_url": "mxc://matrix.org/uDmIFKTXYQpzipNELqRhWSsj", "w": 155}, "msgtype": "m.sticker", "url": "mxc://matrix.org/uDmIFKTXYQpzipNELqRhWSsj", "id": "uDmIFKTXYQpzipNELqRhWSsj"}, {"body": "Work", "info": {"h": 150, "mimetype": "image/png", "size": 81850, "thumbnail_info": {"h": 150, "mimetype": "image/png", "size": 81850, "w": 200}, "thumbnail_url": "mxc://matrix.org/kYOcGZCqtNzBSUqBBOaLDBgE", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/kYOcGZCqtNzBSUqBBOaLDBgE", "id": "kYOcGZCqtNzBSUqBBOaLDBgE"}]}
|
|
@ -1 +0,0 @@
|
|||
{"title": "Sheltie", "id": "scalar-192093", "stickers": [{"body": "Busy", "info": {"h": 173, "mimetype": "image/png", "size": 132161, "thumbnail_info": {"h": 173, "mimetype": "image/png", "size": 132161, "w": 200}, "thumbnail_url": "mxc://matrix.org/KbQyHYcnRFPSfRCbGqbTBiWt", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/KbQyHYcnRFPSfRCbGqbTBiWt", "id": "KbQyHYcnRFPSfRCbGqbTBiWt"}, {"body": "Confused", "info": {"h": 200, "mimetype": "image/png", "size": 111042, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 111042, "w": 173}, "thumbnail_url": "mxc://matrix.org/KkCmAbAPsgeUFdOyOceqAFBr", "w": 173}, "msgtype": "m.sticker", "url": "mxc://matrix.org/KkCmAbAPsgeUFdOyOceqAFBr", "id": "KkCmAbAPsgeUFdOyOceqAFBr"}, {"body": "Happy", "info": {"h": 158, "mimetype": "image/png", "size": 110679, "thumbnail_info": {"h": 158, "mimetype": "image/png", "size": 110679, "w": 200}, "thumbnail_url": "mxc://matrix.org/gFrdGIZbVATfwziAHnIYwEuh", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/gFrdGIZbVATfwziAHnIYwEuh", "id": "gFrdGIZbVATfwziAHnIYwEuh"}, {"body": "Hungry", "info": {"h": 183, "mimetype": "image/png", "size": 97642, "thumbnail_info": {"h": 183, "mimetype": "image/png", "size": 97642, "w": 200}, "thumbnail_url": "mxc://matrix.org/LWtWooRvIbhgLjQPPtyhWNgP", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/LWtWooRvIbhgLjQPPtyhWNgP", "id": "LWtWooRvIbhgLjQPPtyhWNgP"}, {"body": "Innocent", "info": {"h": 200, "mimetype": "image/png", "size": 107331, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 107331, "w": 186}, "thumbnail_url": "mxc://matrix.org/IItfiFhKoPieFyPLceBLcFhd", "w": 186}, "msgtype": "m.sticker", "url": "mxc://matrix.org/IItfiFhKoPieFyPLceBLcFhd", "id": "IItfiFhKoPieFyPLceBLcFhd"}, {"body": "Laughing", "info": {"h": 200, "mimetype": "image/png", "size": 118620, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 118620, "w": 194}, "thumbnail_url": "mxc://matrix.org/LxEPZAsPAfjyRfAwpYSoIxwV", "w": 194}, "msgtype": "m.sticker", "url": "mxc://matrix.org/LxEPZAsPAfjyRfAwpYSoIxwV", "id": "LxEPZAsPAfjyRfAwpYSoIxwV"}, {"body": "Sad", "info": {"h": 200, "mimetype": "image/png", "size": 104622, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 104622, "w": 177}, "thumbnail_url": "mxc://matrix.org/MjdsQxPFskrLFQfXHFuJrwbr", "w": 177}, "msgtype": "m.sticker", "url": "mxc://matrix.org/MjdsQxPFskrLFQfXHFuJrwbr", "id": "MjdsQxPFskrLFQfXHFuJrwbr"}, {"body": "Sleepy", "info": {"h": 200, "mimetype": "image/png", "size": 116609, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 116609, "w": 196}, "thumbnail_url": "mxc://matrix.org/iqEhhOuswzPITADcrmQZPxbh", "w": 196}, "msgtype": "m.sticker", "url": "mxc://matrix.org/iqEhhOuswzPITADcrmQZPxbh", "id": "iqEhhOuswzPITADcrmQZPxbh"}, {"body": "Thank-you", "info": {"h": 200, "mimetype": "image/png", "size": 109865, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 109865, "w": 160}, "thumbnail_url": "mxc://matrix.org/qnyciftjKPqVDyEIjcakwCUO", "w": 160}, "msgtype": "m.sticker", "url": "mxc://matrix.org/qnyciftjKPqVDyEIjcakwCUO", "id": "qnyciftjKPqVDyEIjcakwCUO"}, {"body": "Thumb-up", "info": {"h": 200, "mimetype": "image/png", "size": 120744, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 120744, "w": 184}, "thumbnail_url": "mxc://matrix.org/xHCAaOqwMjyJYQMHIFIgeryn", "w": 184}, "msgtype": "m.sticker", "url": "mxc://matrix.org/xHCAaOqwMjyJYQMHIFIgeryn", "id": "xHCAaOqwMjyJYQMHIFIgeryn"}]}
|
|
@ -1 +0,0 @@
|
|||
{"title": "Smilies", "id": "scalar-192094", "stickers": [{"body": "I'm really angry!", "info": {"h": 256, "mimetype": "image/png", "size": 20840, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 20840, "w": 256}, "thumbnail_url": "mxc://matrix.org/vjgWJdgaAdPLYJMsAjbJrOIa", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/vjgWJdgaAdPLYJMsAjbJrOIa", "id": "vjgWJdgaAdPLYJMsAjbJrOIa"}, {"body": "I'm dead tired", "info": {"h": 256, "mimetype": "image/png", "size": 20143, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 20143, "w": 256}, "thumbnail_url": "mxc://matrix.org/GAZUrYmcYRtcNofjGGqAWhqI", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/GAZUrYmcYRtcNofjGGqAWhqI", "id": "GAZUrYmcYRtcNofjGGqAWhqI"}, {"body": "I'm really happy", "info": {"h": 256, "mimetype": "image/png", "size": 20509, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 20509, "w": 256}, "thumbnail_url": "mxc://matrix.org/SthCvLTenNJopFCEzEeZEwJy", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/SthCvLTenNJopFCEzEeZEwJy", "id": "SthCvLTenNJopFCEzEeZEwJy"}, {"body": "Friday I'm in love!", "info": {"h": 256, "mimetype": "image/png", "size": 20726, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 20726, "w": 256}, "thumbnail_url": "mxc://matrix.org/sCpzSdxGKNVTyyaaTtDvKIVw", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/sCpzSdxGKNVTyyaaTtDvKIVw", "id": "sCpzSdxGKNVTyyaaTtDvKIVw"}, {"body": "Show me the money!", "info": {"h": 256, "mimetype": "image/png", "size": 20852, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 20852, "w": 256}, "thumbnail_url": "mxc://matrix.org/RPsEdZjVSCdxklObGMzyeUBm", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/RPsEdZjVSCdxklObGMzyeUBm", "id": "RPsEdZjVSCdxklObGMzyeUBm"}, {"body": "I'm just sad", "info": {"h": 256, "mimetype": "image/png", "size": 22825, "thumbnail_info": {"h": 256, "mimetype": "image/png", "size": 22825, "w": 256}, "thumbnail_url": "mxc://matrix.org/RseXEsYHhkmmiGCzKYDuFyZt", "w": 256}, "msgtype": "m.sticker", "url": "mxc://matrix.org/RseXEsYHhkmmiGCzKYDuFyZt", "id": "RseXEsYHhkmmiGCzKYDuFyZt"}]}
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
{"title": "Stickman", "id": "scalar-192096", "stickers": [{"body": "A hastily-rendered stick figure stares at you blankly. Its arms are folded: perhaps defensively, perhaps in a half-hearted Gangnam Style.", "info": {"h": 200, "mimetype": "image/png", "size": 28154, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 28154, "w": 106}, "thumbnail_url": "mxc://matrix.org/bQGEpjrZQcWLgygXmuaJCNNA", "w": 106}, "msgtype": "m.sticker", "url": "mxc://matrix.org/bQGEpjrZQcWLgygXmuaJCNNA", "id": "bQGEpjrZQcWLgygXmuaJCNNA"}, {"body": "Question marks of varying sizes orbit a stick figure's head.", "info": {"h": 194, "mimetype": "image/png", "size": 95200, "thumbnail_info": {"h": 194, "mimetype": "image/png", "size": 95200, "w": 200}, "thumbnail_url": "mxc://matrix.org/aVdcZtGRijWluoSjCAytBHnP", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/aVdcZtGRijWluoSjCAytBHnP", "id": "aVdcZtGRijWluoSjCAytBHnP"}, {"body": "A hastily-rendered stick figure stands with arms outstretched, smiling, beneath the word 'HOORAY' in an arc above its head. The figure is smiling in celebration.", "info": {"h": 200, "mimetype": "image/png", "size": 27199, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 27199, "w": 142}, "thumbnail_url": "mxc://matrix.org/BMcDXCuQjoAaWvlPBlUjXBNa", "w": 142}, "msgtype": "m.sticker", "url": "mxc://matrix.org/BMcDXCuQjoAaWvlPBlUjXBNa", "id": "BMcDXCuQjoAaWvlPBlUjXBNa"}, {"body": "A hastily-rendered stick figure stands with arms in the air beneath three blue-and-white juggling balls apparently in motion. We cannot tell whether the figure is juggling competently or has simply thrown all three balls into the air and is awaiting the inevitable. The figure's mouth is formed into an enigmatic 'o'.", "info": {"h": 200, "mimetype": "image/png", "size": 30170, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 30170, "w": 88}, "thumbnail_url": "mxc://matrix.org/mQEotjwsEKeZivqIfZjxNfgC", "w": 88}, "msgtype": "m.sticker", "url": "mxc://matrix.org/mQEotjwsEKeZivqIfZjxNfgC", "id": "mQEotjwsEKeZivqIfZjxNfgC"}, {"body": "A hastily-rendered stick figure is thinking about lunch. Shouldn't you be thinking about lunch?", "info": {"h": 187, "mimetype": "image/png", "size": 55105, "thumbnail_info": {"h": 187, "mimetype": "image/png", "size": 55105, "w": 200}, "thumbnail_url": "mxc://matrix.org/ZHGncPEBowOpxqbVYCGbBTff", "w": 200}, "msgtype": "m.sticker", "url": "mxc://matrix.org/ZHGncPEBowOpxqbVYCGbBTff", "id": "ZHGncPEBowOpxqbVYCGbBTff"}, {"body": "A hastily-rendered stick figure stands with arms outstretched, smiling.", "info": {"h": 200, "mimetype": "image/png", "size": 26585, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 26585, "w": 138}, "thumbnail_url": "mxc://matrix.org/FGCzIxIKpswOIJCWZUWlCoKi", "w": 138}, "msgtype": "m.sticker", "url": "mxc://matrix.org/FGCzIxIKpswOIJCWZUWlCoKi", "id": "FGCzIxIKpswOIJCWZUWlCoKi"}, {"body": "A hastily-rendered stick figure stands holding a placard which reads 'I HAVE OPINIONS'. The figure's mouth is wide and angry, suggesting said opinions might not be the same as yours.", "info": {"h": 200, "mimetype": "image/png", "size": 45505, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 45505, "w": 139}, "thumbnail_url": "mxc://matrix.org/eSdUNjchqskXmCOiLgjqsakm", "w": 139}, "msgtype": "m.sticker", "url": "mxc://matrix.org/eSdUNjchqskXmCOiLgjqsakm", "id": "eSdUNjchqskXmCOiLgjqsakm"}, {"body": "A hastily-rendered stick figure stands with arms in the air. The figure's mouth is formed into an enigmatic 'o'.", "info": {"h": 200, "mimetype": "image/png", "size": 25059, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 25059, "w": 132}, "thumbnail_url": "mxc://matrix.org/puRSMGiaBfdAwYzfdHQFiJMJ", "w": 132}, "msgtype": "m.sticker", "url": "mxc://matrix.org/puRSMGiaBfdAwYzfdHQFiJMJ", "id": "puRSMGiaBfdAwYzfdHQFiJMJ"}, {"body": "A hastily-rendered stick figure has put on its robe and wizard hat.", "info": {"h": 200, "mimetype": "image/png", "size": 43579, "thumbnail_info": {"h": 200, "mimetype": "image/png", "size": 43579, "w": 108}, "thumbnail_url": "mxc://matrix.org/aplWcQPboleenDWMurAdHpHb", "w": 108}, "msgtype": "m.sticker", "url": "mxc://matrix.org/aplWcQPboleenDWMurAdHpHb", "id": "aplWcQPboleenDWMurAdHpHb"}]}
|
File diff suppressed because one or more lines are too long
|
@ -68,9 +68,9 @@ export class GiphySearchTab extends Component {
|
|||
widgetAPI.sendSticker({
|
||||
"body": gif.title,
|
||||
"info": {
|
||||
"h": +gif.images.original.height,
|
||||
"w": +gif.images.original.width,
|
||||
"size": +gif.images.original.size,
|
||||
"h": gif.images.original.height,
|
||||
"w": gif.images.original.width,
|
||||
"size": gif.images.original.size,
|
||||
"mimetype": "image/webp",
|
||||
},
|
||||
"msgtype": "m.image",
|
||||
|
|
Loading…
Add table
Reference in a new issue