mirror of
https://github.com/wah-su/stickerbridge.git
synced 2025-04-05 15:54:41 +00:00
add full telegram sticker link support
This commit is contained in:
parent
75419f5906
commit
b9461d75be
2 changed files with 6 additions and 2 deletions
|
@ -32,7 +32,7 @@ class Command:
|
|||
"I am the bot that imports stickers from Telegram and upload them to Matrix rooms\n\n"
|
||||
"List of commands:\n"
|
||||
"help - Show this help message.\n"
|
||||
"import <pack_name> [import_name] - Use this to import Telegram stickers from given link. import_name is pack_name if not provided"
|
||||
"import <url|pack_name> [import_name] - Use this to import Telegram stickers from given link. import_name is pack_name if not provided"
|
||||
)
|
||||
await send_text_to_room(self.client, self.room.room_id, text)
|
||||
|
||||
|
|
|
@ -72,8 +72,12 @@ class TelegramExporter:
|
|||
async def get_stickerset(self, pack_name: str) -> list[Sticker]:
|
||||
result: List[Sticker] = list()
|
||||
|
||||
short_name = pack_name
|
||||
if short_name.startswith('http'):
|
||||
short_name = pack_name.split("/")[-1]
|
||||
|
||||
try:
|
||||
sticker_set = await self.client(GetStickerSetRequest(InputStickerSetShortName(short_name=pack_name), hash=0))
|
||||
sticker_set = await self.client(GetStickerSetRequest(InputStickerSetShortName(short_name=short_name), hash=0))
|
||||
except StickersetInvalidError:
|
||||
return result # return empty on fail
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue